-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Playing certain ogg files cause crashes in 2.4.2 that did not in 2.1 #1241
Comments
We'll need a truly complete, and minimal, program that reproduce the issue. Also, check what happens with the master version. Further details on how to report bugs are explained in the contribution guidelines. And what happens if you read the ogg file with |
OK so I've looked at this. Here's a minimal testcase which crashes: https://gist.github.com/jcowgill/4fa0b227e1575e4baec82833a63d1bfa I've adjusted the testcase to remove the There are 2 bugs here:
|
And here's my vorbis bug for reference: https://trac.xiph.org/ticket/2327 |
Thank you! |
Are there any docs on updating sfml's dependencies so I can see if this would remedy my problem? I've tried downloading libogg and libvorbis, applying the patch @jcowgill made, then I built libogg_static.lib, libvorbis_static.lib, and libvorbisfile_static.lib, moved those to the appropriate extlibs directories in SFML, renamed them to match the naming that SFML uses, then built the project, but now I am not hearing any sound. I'm unsure if I have just set something up incorrectly, or if I have built the dependencies wrong, or if something else is going on. |
You will have not sound, because your InputStream::seek is wrong. Read jcowgill commend. |
@1aam2am1 I have added in the clear call within seek as suggested. Additionally - we previous had ogg files that would play. Now none of them play. With/without this suggestion no sound plays at all. |
I'm not sure if I can help you much here. Adding the call to sf::Int64 MyStream::seek(sf::Int64 position)
{
_stream.clear();
_stream.seekg(position, std::ios_base::beg);
return tell();
} I'm using Debian 9 x86_64. I haven't tried windows. |
The culprit is |
SFML/SFML#1241 https://trac.xiph.org/ticket/2327 https://gitlab.xiph.org/xiph/vorbis/issues/2327 If _seek_helper fails in ov_raw_seek, control jumps to the seek_error label which calls ogg_stream_clear on work_os. However, at this point in the function, work_os is not initialized so we end up attempting to free some uninitialized memory and crashing. Fix by removing the call to ogg_stream_clear. This is safe because the only code path to seek_error happens before work_os is initialized (so there is never anything to free anyway). I also refactor the code a bit: - Remove the ret variable which is unnessesary since we can just pass the result of _seek_helper directly to the if. - Since seek_error is only used once, move the contents of that block to the if statement so we can remove a goto.
Hello,
I am updating an application that uses sfml-audio from 2.1 to 2.4.2 that consistently crashes when playing certain ogg files. These files did not crash in 2.1, and its worth noting that they only crash when loading from stream, but if they are loaded from file they play fine.
Here is an example of an overridden InputStream class that suffers this issue:
I believe I am following the guidelines listed here: https://www.sfml-dev.org/tutorials/2.4/system-stream.php
Here is the problematic ogg file. This file passes the oggz validate program.
I should note that I have tried the above changing the implementation slightly - using raw pointers, using a raw filebuf, etc., but all modifications suffer from the same issue. If I set the istreams exceptions and wrap each call in a try/catch, it seems that read fails due to the eof bit being set.
An additional peculiar thing to note is that if I open the problematic file in audacity and save it with varying levels of compression I get different results. Here is the file and its results for each 10 quality levels Audacity allows me to export the file to:
0 quality - program runs, no audio plays
1 quality - same as above
2 quality - program crashes
3 quality - program hangs forever
4 quality - no audio plays
5 quality - program works, audio plays
6 quality - crashes
7 quality - crashes
8 quality - program works, audio plays
9 quality - program works, audio plays
10 quality - program works, audio plays
I know that since 2.1 SFML has removed libsndfile - is it possible that my problem is related to this?
Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered: