complexlogic/rsgain

TagLib causing SegFault from MP4 with video

Undearius opened this issue · 1 comments

After hours of narrowing down the file causing the segfault, I got hit with the ultimate Rick Roll:
https://transfer.sh/77AceW2UaE/rick.mp4

I honestly had no idea this file was in my collection, and I have no need for it, but I figured this information would help to make the program more robust.

rsgain easy .

[✔] Building directory tree...
[✔] Found 1 directory...
[✔] Scanning directory for files...
[✔] Scanning './01 Never Gonna Give You Up.mp4'
[✔] Container: QuickTime / MOV [mov,mp4,m4a,3gp,3g2,mj2]
[✔] Stream #2: AAC (Advanced Audio Coding), 22,050 Hz, 2 ch
 100% [===============================================]
Segmentation fault (core dumped)

ffprobe

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x559b034908c0] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01 Never Gonna Give You Up.mp4':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder-eng     : Lavf51.8.0
    title-eng       : Never Gonna Give You Up
    album           : Whenever You Need Somebody
    track           : 1/10
    disc            : 1/1
    date            : 1987-10-01
    compilation     : 1
    sort_album_artist: Astley, Rick
    sort_artist     : Astley, Rick
    album_artist    : Rick Astley
    creation_time   : 1970-01-01T00:00:00.000000Z
    com.apple.quicktime.displayname: Never Gonna Give You Up
    com.apple.quicktime.artist: Rick Astley
    playback_requirements: QuickTime 6.0 or greater
    playback_requirements-eng: QuickTime 6.0 or greater
    encoder         : Lavf51.8.0
    artist-eng      : Rick Astley
    title           : Never Gonna Give You Up
    artist          : Rick Astley
  Duration: 00:03:32.75, start: 0.000000, bitrate: 398 kb/s
  Stream #0:0[0x0]: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 953x953 [SAR 200:200 DAR 1:1], 90k tbr, 90k tbn (attached pic)
  Stream #0:1[0x1](eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 323 kb/s, 24 fps, 24 tbr, 24 tbn (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : mpeg4
  Stream #0:2[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]

Journalctl

Nov 01 01:13:24 PC kernel: rsgain[375562]: segfault at 10 ip 00007f0b903a8f34 sp 00007ffe9f993718 error 4 in libtag.so.1.19.1[7f0b90347000+77000] likely on CPU 4 (core 4, socket 0)
Nov 01 01:13:24 PC kernel: Code: ff 4d 39 f7 75 84 e9 d4 fe ff ff 0f 1f 00 b8 01 00 00 00 e9 bd fe ff ff f3 0f 1e fa 48 89 c3 e9 fe c2 fa ff 66 90 f3 0f 1e fa <48> 8b 7f 10 48 83 c7 10 e9 1f fe ff ff 90 66 66 2e 0f 1f 84 00 00
Nov 01 01:13:24 PC systemd[1]: Started Process Core Dump (PID 375563/UID 0).
Nov 01 01:13:24 PC systemd-coredump[375564]: [🡕] Process 375562 (rsgain) of user 1000 dumped core.
                                                   
                                                   Stack trace of thread 375562:
                                                   #0  0x00007f0b903a8f34 _ZN6TagLib3MP43Tag10removeItemERKNS_6StringE (libtag.so.1 + 0xa5f34)
                                                   #1  0x0000557c54087c9a n/a (rsgain + 0x18c9a)
                                                   #2  0x0000557c5407ee64 n/a (rsgain + 0xfe64)
                                                   #3  0x0000557c54081cc0 n/a (rsgain + 0x12cc0)
                                                   #4  0x0000557c5408cdb9 n/a (rsgain + 0x1ddb9)
                                                   #5  0x0000557c5408efdc n/a (rsgain + 0x1ffdc)
                                                   #6  0x0000557c54077c89 n/a (rsgain + 0x8c89)
                                                   #7  0x00007f0b8e445cd0 n/a (libc.so.6 + 0x27cd0)
                                                   #8  0x00007f0b8e445d8a __libc_start_main (libc.so.6 + 0x27d8a)
                                                   #9  0x0000557c54077ff5 n/a (rsgain + 0x8ff5)
                                                   ELF object binary architecture: AMD x86-64

Thanks for the report. I'm able to confirm this on my end. It's actually a bug in rsgain. The root cause is dereferencing a null pointer returned by TagLib.

I'll provide a fix in the near future. In the meantime, you should be able to work around this by using the SkipMP4 setting in the Easy Mode presets.