liballeg / allegro5

The official Allegro 5 git repository. Pull requests welcome!
https://liballeg.org
Other
1.89k stars 286 forks source link

segfault when loading mp3 #1569

Closed connorjclark closed 3 months ago

connorjclark commented 3 months ago

When loading a specific mp3 file, this error state is hit:

https://github.com/liballeg/allegro5/blob/7648fdf6824f67aa72c3c82f3accde94434ecede/addons/acodec/mp3.c#L294-L297

On clean up, this results in a segfault:

https://github.com/liballeg/allegro5/blob/7648fdf6824f67aa72c3c82f3accde94434ecede/addons/acodec/mp3.c#L343

I suppose the mp3file hasn't been initialized to the expected state, so freeing here is corrupting memory.

As for the error ... idk what that's about, the file loads fine in Windows media players.

mp3: https://drive.google.com/file/d/1wTnx4tf8ezHuJsitcTNkDZ5K2j5u6RGq/view?usp=sharing

SiegeLord commented 3 months ago

I fixed the crashes, but I don't know what's wrong with the file. VLC can't play it, and I also tested the minimp3's bundled player, which couldn't play it either. But a few other players could handle it, like you said.

connorjclark commented 3 months ago

Thanks for the super quick fix!

I'll let you know if I can figure out a resolution for the actual error.

SiegeLord commented 3 months ago

I don't think this is an mp3 file, so far it looks like a webm file.

fmpeg -i LA\ Catfish.mp3                                                                                                                     12:11:24
ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)
  configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, matroska,webm, from 'LA Catfish.mp3':
  Metadata:
    encoder         : google/video-file
  Duration: 00:02:17.08, start: -0.007000, bitrate: 58 kb/s
  Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
At least one output file must be specified
connorjclark commented 3 months ago

fascinating! Well that closes out this mystery. Thanks again for saving me some time.