arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.55k stars 605 forks source link

FFMpegKit crash with xHE-AAC #874

Open Tolriq opened 1 year ago

Tolriq commented 1 year ago

Description FFmpegkit crash when trying to use xHE-AAC files (FFProbe for example)

Expected behavior It should not crash the app and just return an error

Current behavior The app crash

12:53:23.995 libc                    app.symfonik.music.player.debug      A  FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7808cef028)
12:53:23.996 libc                    app.symfonik.music.player.debug      A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 12453 (RenderThread), pid 12366 (ic.player.debug)

Strangely there's no dump or anything more in logcat.

To Reproduce Try to use ffprobe on any of the mp4 file from https://www2.iis.fraunhofer.de/AAC/xhe-aac.html

Screenshots If applicable, add screenshots to help explain your problem.

Logs

12:53:23.995 libc                    app.symfonik.music.player.debug      A  FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7808cef028)
12:53:23.996 libc                    app.symfonik.music.player.debug      A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 12453 (RenderThread), pid 12366 (ic.player.debug)

Environment

Other Add any other context about the problem here.

Tolriq commented 11 months ago

@tanersener So after tons of time lost to try to understand WTF was happening on Android the issue are the few exit(1); still present in fftools_ffprobe.c those trigger the crash. You have removed most of them everywhere so I guess it's just a small forget.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Tolriq commented 9 months ago

Installé it's still to be fixed

mathieu-aubin commented 9 months ago

ffprobe 6.1.1 (linux, fedora, x86_64) outputs a bunch of stuff but mainly

[aac @ 0x7fbb1200f440] Audio object type 42 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.

could this throw an error with toyr implementation ?

Tolriq commented 9 months ago

No this is a bug in ffmpegkit when it encounters those errors it runs exit(1); that triggers the OS crash.

@tanersener knows that since most of the other exit() calls have been removed for this purpose, just 3 leftovers that are reached with those kind of media.

For example https://github.com/arthenica/ffmpeg-kit/blob/main/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c#L3387

Those must be exit_program to avoid the crash.

tanersener commented 7 months ago

Thanks a lot for reporting the bug and providing the fix @Tolriq. The fix is pushed to the development branch now.