codec/substtml: crash on empty attribute(s)
The relevant module will crash if the ttml-data contains at least one layout/region
, and an empty region-attribute is later found on one of the subtitles.
gdb session
(gdb) run
Starting program: /home/refp/work/videolan/vlc/git/builds/branches/ttml/bin/vlc-static --sub-file empty-region-ttml.xml john.mkv
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
VLC media player 3.0.0-git Vetinari (revision 2.2.0-git-8955-g9374565)
...
Thread 20 "vlc-static" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff9b32d700 (LWP 18670)]
0x00007ffff6a0029e in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
(gdb) bt
[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007ffff6a0029e in __strcmp_sse2_unaligned () from /usr/lib/libc.so.6
[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x00007fff9b32f726 in FindTextStyle (psz_style=psz_style@entry=0x0, p_dec=<optimized out>) at ../../../../modules/codec/substtml.c:163
[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x00007fff9b32fc20 in ParseTTMLStyle (p_dec=p_dec@entry=0x7fffb991d968, p_reader=p_reader@entry=0x7fff8c000e88, psz_node_name=psz_node_name@entry=0x7fff8c007f30 "p")
at ../../../../modules/codec/substtml.c:273
[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x00007fff9b330aff in ParseTTMLSubtitles (
psz_subtitle=0x7fff8c0008c0 "<tt ttp:cellResolution=\"50 30\" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\" xml:lang=\"en\" ttp:timeBase=\"media\" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\" xmlns=\"http://www.w3.org/ns/ttml\" xmlns:"..., p_update_sys=0x7fff8c0009e0, p_dec=0x7fffb991d968)
at ../../../../modules/codec/substtml.c:589
[#4](https://code.videolan.org/videolan/vlc/-/issues/4) ParseText (p_block=0x7fffb9b10e30, p_dec=0x7fffb991d968) at ../../../../modules/codec/substtml.c:787
[#5](https://code.videolan.org/videolan/vlc/-/issues/5) DecodeBlock (p_dec=0x7fffb991d968, pp_block=0x7fff9b32ce28) at ../../../../modules/codec/substtml.c:804
[#6](https://code.videolan.org/videolan/vlc/-/issues/6) 0x00007ffff78fc2bb in DecoderProcessSpu (p_block=<optimized out>, p_dec=<optimized out>) at ../../../../src/input/decoder.c:1383
[#7](https://code.videolan.org/videolan/vlc/-/issues/7) DecoderProcess (p_block=0x7fffb9b10e30, p_dec=<optimized out>) at ../../../../src/input/decoder.c:1436
[#8](https://code.videolan.org/videolan/vlc/-/issues/8) DecoderThread (p_data=<optimized out>) at ../../../../src/input/decoder.c:1584
[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x00007ffff6f1a454 in start_thread () from /usr/lib/libpthread.so.0
[#10](https://code.videolan.org/videolan/vlc/-/issues/10) 0x00007ffff6a597df in clone () from /usr/lib/libc.so.6
Update
This is reproducible with other attributes than just region
(as this ticket was originally addressing), relevant testcases will be added when/if such are discovered.
Edited by Filip Roséen