Segfault in FLAC encoder if .wav cue chunk has > 128 entries
Describe your issue
Telling gst-launch-1.0 to encode a FLAC from a WAV with > 128 cue segments segfaults
For example, here's one with 512 cue segments
Expected Behavior
Give me a flac file. Preferably including the cue segment, but if libflac doesn't support large cue segments (I can't quite make sense of FLAC__metadata_object_cuesheet_track_insert_index track_num, FLAC__metadata_object_cuesheet_track_insert_index index_num, and FLAC__StreamMetadata_CueSheet_Track number), drop or truncate it with a warning.
Observed Behavior
Caught SIGSEGV
#0 0x00007ff9bccf603f in __GI___poll (fds=0x557b07f1ffe0, nfds=2, timeout=94) at ../sysdeps/unix/sysv/linux/poll.c:29
#1 0x00007ff9bce8e9ae in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
Setup
- Operating System: Debian 12
- Device: A perfectly normal x86_64 computer
- GStreamer Version: 1.22.0
- Command line: gst-launch-1.0 filesrc location=kaboom.wav ! decodebin ! flacenc ! filesink location=kaboom.flac
Steps to reproduce the bug
- Download this file
- gst-launch-1.0 filesrc location=kaboom.wav ! decodebin ! flacenc ! filesink location=kaboom.flac
How reproducible is the bug?
Always
Screenshots if relevant
Not relevant for terminal tools
Solutions you have tried
I guess I could remove or truncate the cue chunk from the wav
Related non-duplicate issues
Can't find any
Additional Information
Asking Valgrind for help returns
==1307514== Thread 4 wavparse0:sink:
==1307514== Invalid read of size 8
==1307514== at 0x484A4B0: memmove (vg_replace_strmem.c:1382)
==1307514== by 0x6630C7E: FLAC__metadata_object_cuesheet_insert_track (in /usr/lib/x86_64-linux-gnu/libFLAC.so.12.0.0)
==1307514== by 0x485C0B6: ??? (in /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstflac.so)
I've also seen a few
(gst-launch-1.0:1307557): GStreamer-WARNING **: 12:02:50.316: ../gst/gstpad.c:5366:store_sticky_event:<flacenc0:src> Sticky event misordering, got 'segment' before 'caps'
(gst-launch-1.0:1307557): GStreamer-WARNING **: 12:02:50.317: ../gst/gstpad.c:5366:store_sticky_event:<filesink0:sink> Sticky event misordering, got 'segment' before 'caps'
while reducing this bug, but I think that's unrelated and harmless.