SIGFPE (divide by zero) while transcoding in transcode_video_encounter_init
We run VLC as a daemon to transcode an MJPEG stream from a StarDot camera and pipe it into another program. After upgrading from (what I think was) 2.0.3 to 2.2.1 (as part of an upgrade from Debian 7 to Debian 8), it began crashing; this crash persists with 2.2.4.
Although the root cause is somewhere else, the patch at https://patches.videolan.org/patch/10246/ hides the problem, preventing VLC from crashing.
The attached Motion JPEG file is sufficient to make VLC crash when invoked as follows:
/usr/bin/vlc -I dummy --repeat --sout-keep camp-capture-2.mjpg --sout '#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=500,scale=1,acodec=none,threads=6}:rtp{dst=127.0.0.1,port=10000,mux=ts}' --syslog
At our site, VLC is running in a Debian 8 amd64 VM on a cluster with Intel E5620 CPUs. The VM has one virtual socket with three cores and six gigabytes of RAM. We invoke it as follows:
/usr/bin/vlc -I dummy --repeat --sout-keep --http-reconnect http://ip-redacted/nph-mjpeg.cgi --sout '#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=500,scale=1,acodec=none,threads=6}:rtp{dst=127.0.0.1,port=10000,mux=ts}' --syslog
Data from core dump:
$ gdb /usr/bin/vlc ~/core
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/vlc...Reading symbols from /usr/lib/debug/.build-id/59/71b866af7e3d3a228ce9bed06f5dbcd2f65181.debug...done.
done.
[New LWP 15816]
[New LWP 15814]
[New LWP 15809]
[New LWP 15824]
[New LWP 15806]
[New LWP 15812]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/bin/vlc -I dummy --repeat --sout-keep --http-reconnect http://172.18.51.40'.
Program terminated with signal SIGFPE, Arithmetic exception.
[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007fd3467855b0 in transcode_video_encoder_init (p_stream=0x7fd338008738,
id=0x7fd3340008c0) at transcode/video.c:551
551 id->i_input_frame_interval = id->p_decoder->fmt_out.video.i_frame_rate_base * CLOCK_FREQ / id->p_decoder->fmt_out.video.i_frame_rate;
(gdb) print id->p_decoder->fmt_out.video.i_frame_rate
$1 = 0
(gdb) print id->p_decoder->fmt_out.video.i_frame_rate_base
$2 = 0
(gdb) bt
[#0](https://code.videolan.org/videolan/vlc/-/issues/0) 0x00007fd3467855b0 in transcode_video_encoder_init (p_stream=0x7fd338008738,
id=0x7fd3340008c0) at transcode/video.c:551
[#1](https://code.videolan.org/videolan/vlc/-/issues/1) 0x00007fd346785ebf in transcode_video_process (p_stream=0x7fd338008738,
id=0x7fd3340008c0, in=0x7fd338c353d0, out=0x7fd346787db3,
out@entry=0x7fd3471d6e10) at transcode/video.c:884
[#2](https://code.videolan.org/videolan/vlc/-/issues/2) 0x00007fd34678143b in Send (p_stream=0x7fd338008738, id=0x7fd3340008c0,
p_buffer=<optimized out>) at transcode/transcode.c:661
[#3](https://code.videolan.org/videolan/vlc/-/issues/3) 0x00007fd35933d118 in sout_InputSendBuffer (p_input=0x7fd3340009a0,
p_buffer=p_buffer@entry=0x7fd338c353d0) at stream_output/stream_output.c:233
[#4](https://code.videolan.org/videolan/vlc/-/issues/4) 0x00007fd3592ca994 in DecoderPlaySout (p_sout_block=0x7fd338c353d0,
p_dec=0x7fd338c20018) at input/decoder.c:1501
[#5](https://code.videolan.org/videolan/vlc/-/issues/5) DecoderProcessSout (p_block=0x0, p_dec=<optimized out>) at input/decoder.c:1556
[#6](https://code.videolan.org/videolan/vlc/-/issues/6) DecoderProcess (p_block=<optimized out>, p_dec=<optimized out>)
at input/decoder.c:1787
[#7](https://code.videolan.org/videolan/vlc/-/issues/7) DecoderThread (p_data=0x7fd338c20018) at input/decoder.c:909
[#8](https://code.videolan.org/videolan/vlc/-/issues/8) 0x00007fd359b440a4 in start_thread (arg=0x7fd3471d7700) at pthread_create.c:309
[#9](https://code.videolan.org/videolan/vlc/-/issues/9) 0x00007fd35967587d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)
This bug was reported to Debian as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825431; https://bugzilla.opensuse.org/show_bug.cgi?id=978282 may be the same bug.