-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix OggPacketSequencePlayback::next_ogg_packet()
never returning false
#85996
Conversation
OggPacketSequencePlayback::next_ogg_packet()
never returning falseOggPacketSequencePlayback::next_ogg_packet()
never returning false
To clarify the issue here: Previous to #80452, this function acted as originally intended: It would keep serving up the next packet and returning That PR changed that behavior such that, when it reaches the end of the stream, it'll keep serving up the last packet and returning true forever; it won't ever return false. Besides being intuitive, this is just semantically incorrect behavior, as there's no point to have a boolean value as a return value if there's no While none of its current usages in Godot use this to detect the EOS, this is a pretty obvious footgun that can result in infinite loops and could easily become a hazard in the future. Since none of the Godot usages were using this to detect the EOS (they checked the packet for the |
@bs-mwoerner I saw you responded in the comment linked in the description here. Does this change seem like it could have unintended consequences? The rationale given seems sound I just want to check. |
I don't see any problems with this change. When we call I say go ahead with the change. There's even still a comment in the header that says it returns "false on error or if there is no next packet". |
Thanks for weighing in! |
Thanks! |
Cherry-picked for 4.2.2. |
This fixes a bug introduced in #80452 (see #80452 (review)). The check that was here caused this function to never return false.
I've tested this with the example projects provided in the issues that the PR purported to fix, and it causes no issues.