[Ffmpeg-devel] [BUG] MPEG 2 Division By Zero
Brian Brice
bbrice
Tue Oct 31 20:52:48 CET 2006
M?ns Rullg?rd wrote:
> Brian Brice <bbrice at newtek.com> writes:
>
>> Brian Brice wrote:
>>> M?ns Rullg?rd wrote:
>>>> Brian Brice <bbrice at newtek.com> writes:
>>>>
>>>>> Hello.
>>>>>
>>>>> Something quite strange is happening when I'm encoding MPEG 2. I'm
>>>>> encoding clips that are just noise and I get "division by 0" crashes.
>>>>> Unforunately, I can't produce a call stack (using DLLs in Windows from
>>>>> VC++), but I did narrow down where the division is occurring:
>>>> Upload a sample and tell us an FFmpeg command line that reproduces the
>>>> error.
>>>>
>>> Unfortunately I'm not using the command line. :-(
>>> I am linking to the DLLs produced by mingw/gcc from within Visual
>>> Studio. And I know it's not a VS problem (so don't bash, please?),
>>> because this stuff has worked before. I am programmatically generating
>>> frames of noise and throwing them at the encoder. I set only certain
>>> members of AVCodecContext (as mentioned in the first email), and leave
>>> the rest to default.
>>>
>> Sorry, I spoke too soon. Right after I sent that message, I tried
>> making an uncompressed AVI with this noise then using ffmpeg on the
>> command line to reproduce.
>>
>> I uploaded a sample to /MPlayer/incoming/VictoriasNoise
>>
>> Here is a log of the execution:
>
> Does it crash?
>
Yes. Unfortunately mingw/gdb doesn't give a good backtrace. GDB:
(fyi, my ffmpeg binary isn't stripped)
pollux:~> gdb ./ffmpeg
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) run -i VictoriasNoise.avi -f mpeg2video -vcodec mpeg2video -b
18300k -minrate 18300k -maxrate 18300k -bufsize 448K -bf 2 -an out.m2v
FFmpeg version SVN-r6847, Copyright (c) 2000-2006 Fabrice Bellard, et al.
libavutil version: 49.0.2
libavcodec version: 51.23.0
libavformat version: 50.6.0
built on Oct 30 2006 23:12:04, gcc: 3.4.2 (mingw-special)
Input #0, avi, from 'VictoriasNoise.avi':
Duration: 00:00:00.3, start: 0.000000, bitrate: 667437 kb/s
Stream #0.0: Video: rawvideo, bgr24, 1280x720, 29.97 fps(r)
Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Output #0, mpeg2video, to 'out.m2v':
Stream #0.0: Video: mpeg2video, yuv420p, 1280x720, q=2-31, 18300
kb/s, 29.97 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
[mpeg2video @ 0076A000]rc buffer underflow
[mpeg2video @ 0076A000]rc buffer underflow
gdb: Target exception STATUS_INTEGER_DIVIDE_BY_ZERO at 0x0057b2d5
Program received signal SIGFPE, Arithmetic exception.
0x0057b2d5 in ff_set_mpeg4_time (s=0x0, picture_number=1) at h263.c:565
565 s->direct_scale_mv[0][i] =
(i-tab_bias)*s->pb_time/s->pp_time;
(gdb) bt
#0 0x0057b2d5 in ff_set_mpeg4_time (s=0x0, picture_number=1) at h263.c:565
#1 0x000003e9 in ?? ()
(gdb) disass $pc-32 $pc+32
Dump of assembler code from 0x57b2b5 to 0x57b2f5:
0x0057b2b5 <ff_set_mpeg4_time+469>: pop %ds
0x0057b2b6 <ff_set_mpeg4_time+470>: add %al,(%eax)
0x0057b2b8 <ff_set_mpeg4_time+472>: mov %ebp,%ecx
0x0057b2ba <ff_set_mpeg4_time+474>: sub %edi,%ecx
0x0057b2bc <ff_set_mpeg4_time+476>: mov %ecx,0x2c(%esp)
0x0057b2c0 <ff_set_mpeg4_time+480>: mov %ecx,%esi
0x0057b2c2 <ff_set_mpeg4_time+482>: mov %ebp,%ecx
0x0057b2c4 <ff_set_mpeg4_time+484>: shl $0x5,%esi
0x0057b2c7 <ff_set_mpeg4_time+487>: shl $0x5,%ecx
0x0057b2ca <ff_set_mpeg4_time+490>: neg %esi
0x0057b2cc <ff_set_mpeg4_time+492>: neg %ecx
0x0057b2ce <ff_set_mpeg4_time+494>: mov %esi,%esi
0x0057b2d0 <ff_set_mpeg4_time+496>: mov %ecx,%eax
0x0057b2d2 <ff_set_mpeg4_time+498>: cltd
0x0057b2d3 <ff_set_mpeg4_time+499>: add %ebp,%ecx
0x0057b2d5 <ff_set_mpeg4_time+501>: idiv %edi
0x0057b2d7 <ff_set_mpeg4_time+503>: mov 0x50(%esp),%edx
0x0057b2db <ff_set_mpeg4_time+507>: mov %ax,0x159c(%edx,%ebx,2)
0x0057b2e3 <ff_set_mpeg4_time+515>: mov %esi,%eax
0x0057b2e5 <ff_set_mpeg4_time+517>: cltd
0x0057b2e6 <ff_set_mpeg4_time+518>: idiv %edi
0x0057b2e8 <ff_set_mpeg4_time+520>: mov 0x50(%esp),%edx
0x0057b2ec <ff_set_mpeg4_time+524>: mov %ax,0x161c(%edx,%ebx,2)
0x0057b2f4 <ff_set_mpeg4_time+532>: mov 0x2c(%esp),%edx
End of assembler dump.
(gdb) info all-registers
eax 0xffe0fa40 -2033088
ecx 0xffe1f26e -1969554
edx 0xffffffff -1
ebx 0x0 0
esp 0x22bfb0 0x22bfb0
ebp 0xf82e 0xf82e
esi 0xffe0fa40 -2033088
edi 0x0 0
eip 0x57b2d5 0x57b2d5
eflags 0x210282 2163330
cs 0x1b 27
ss 0x23 35
ds 0x23 35
es 0x23 35
fs 0x3b 59
gs 0x0 0
st0 -nan(0x8e85685570978e66) (raw 0xffff8e85685570978e66)
st1 -nan(0x8e008500680055) (raw 0xffff008e008500680055)
st2 -nan(0xa2b7a67c87b9bb91) (raw 0xffffa2b7a67c87b9bb91)
st3 30000 (raw 0x400dea60000000000000)
st4 1e+100 (raw 0x414b924d692ca61be800)
st5 30000 (raw 0x400dea60000000000000)
st6 9.9900099900097732e-006 (raw 0x3feea79ac42546f80000)
st7 0 (raw 0x00000000000000000000)
fctrl 0xffff037f -64641
fstat 0xffff0121 -65247
ftag 0xffffffff -1
fiseg 0x1b 27
fioff 0x403353 4207443
foseg 0xffff0023 -65501
fooff 0x22f598 2291096
fop 0x45c 1116
xmm0 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {
0x8000000000000000, 0x0}, v16_int8 = {0xcc, 0xfd, 0xe4, 0xfd, 0xa5,
0xfe,
0x83, 0xfd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 =
{0xfdcc,
0xfde4, 0xfea5, 0xfd83, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xfde4fdcc,
0xfd83fea5, 0x0, 0x0}, v2_int64 = {0xfd83fea5fde4fdcc, 0x0},
uint128 = 0x0000000000000000fd83fea5fde4fdcc}
xmm1 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {
0x8000000000000000, 0x0}, v16_int8 = {0x99, 0xfe, 0xf2, 0x0, 0x17,
0x0,
0xc5, 0xff, 0xb5, 0xff, 0x5e, 0x0, 0x9f, 0x0, 0x12, 0x0}, v8_int16 = {
0xfe99, 0xf2, 0x17, 0xffc5, 0xffb5, 0x5e, 0x9f, 0x12}, v4_int32 = {
0xf2fe99, 0xffc50017, 0x5effb5, 0x12009f}, v2_int64 =
{0xffc5001700f2fe99,
0x12009f005effb5}, uint128 = 0x0012009f005effb5ffc5001700f2fe99}
xmm2 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {0x80, 0x27, 0xc0, 0xfe, 0xb2, 0xbf, 0x98, 0x0, 0x56,
0x8c, 0xae,
0xfe, 0xf, 0x6b, 0xb5, 0x0}, v8_int16 = {0x2780, 0xfec0, 0xbfb2, 0x98,
0x8c56, 0xfeae, 0x6b0f, 0xb5}, v4_int32 = {0xfec02780, 0x98bfb2,
0xfeae8c56, 0xb56b0f}, v2_int64 = {0x98bfb2fec02780,
0xb56b0ffeae8c56},
uint128 = 0x00b56b0ffeae8c560098bfb2fec02780}
xmm3 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {0xb5, 0xff, 0xff, 0xff, 0x5e, 0x0, 0x0, 0x0, 0x9f, 0x0, 0x0,
0x0, 0x12, 0x0, 0x0, 0x0}, v8_int16 = {0xffb5, 0xffff, 0x5e, 0x0,
0x9f,
0x0, 0x12, 0x0}, v4_int32 = {0xffffffb5, 0x5e, 0x9f, 0x12},
v2_int64 = {
0x5effffffb5, 0x120000009f}, uint128 =
0x000000120000009f0000005effffffb5}
xmm4 {v4_float = {0xc24b42, 0x88000000, 0x0, 0xfffff904},
v2_double = {0x8000000000000000, 0x8000000000000000}, v16_int8 = {0x42,
0x4b, 0x42, 0x4b, 0x62, 0x68, 0x7e, 0x58, 0x46, 0xd7, 0xac, 0x9d,
0x9e,
0x97, 0xdf, 0xc4}, v8_int16 = {0x4b42, 0x4b42, 0x6862, 0x587e, 0xd746,
0x9dac, 0x979e, 0xc4df}, v4_int32 = {0x4b424b42, 0x587e6862,
0x9dacd746,
0xc4df979e}, v2_int64 = {0x587e68624b424b42, 0xc4df979e9dacd746},
uint128 = 0xc4df979e9dacd746587e68624b424b42}
xmm5 {v4_float = {0xc24b42, 0x0, 0x0, 0x0}, v2_double = {0x0,
0x8000000000000000}, v16_int8 = {0x42, 0x4b, 0x42, 0x4b, 0x21,
0x3b, 0xc3,
0x14, 0x54, 0x62, 0xba, 0x28, 0x7e, 0x58, 0x3d, 0xeb}, v8_int16 =
{0x4b42,
0x4b42, 0x3b21, 0x14c3, 0x6254, 0x28ba, 0x587e, 0xeb3d}, v4_int32 = {
0x4b424b42, 0x14c33b21, 0x28ba6254, 0xeb3d587e}, v2_int64 = {
0x14c33b214b424b42, 0xeb3d587e28ba6254},
uint128 = 0xeb3d587e28ba625414c33b214b424b42}
xmm6 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1,
0x0, 0x0,
0x0, 0x1, 0x0}, v8_int16 = {0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1},
v4_int32 = {0x10000, 0x10000, 0x10000, 0x10000}, v2_int64 = {
0x1000000010000, 0x1000000010000},
uint128 = 0x00010000000100000001000000010000}
xmm7 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {0xa4, 0x8c, 0x50, 0x0, 0x39, 0x87, 0x1b, 0x0, 0x3e, 0x11,
0x5b,
0x0, 0x40, 0x4a, 0x32, 0x0}, v8_int16 = {0x8ca4, 0x50, 0x8739, 0x1b,
0x113e, 0x5b, 0x4a40, 0x32}, v4_int32 = {0x508ca4, 0x1b8739, 0x5b113e,
0x324a40}, v2_int64 = {0x1b873900508ca4, 0x324a40005b113e},
uint128 = 0x00324a40005b113e001b873900508ca4}
mxcsr 0x1f80 8064
mm0 {uint64 = 0x8e85685570978e66, v2_int32 = {0x70978e66,
0x8e856855}, v4_int16 = {0x8e66, 0x7097, 0x6855, 0x8e85}, v8_int8 =
{0x66,
0x8e, 0x97, 0x70, 0x55, 0x68, 0x85, 0x8e}}
mm1 {uint64 = 0x8e008500680055, v2_int32 = {0x680055, 0x8e0085},
v4_int16 = {0x55, 0x68, 0x85, 0x8e}, v8_int8 = {0x55, 0x0, 0x68, 0x0,
0x85,
0x0, 0x8e, 0x0}}
mm2 {uint64 = 0xa2b7a67c87b9bb91, v2_int32 = {0x87b9bb91,
0xa2b7a67c}, v4_int16 = {0xbb91, 0x87b9, 0xa67c, 0xa2b7}, v8_int8 =
{0x91,
0xbb, 0xb9, 0x87, 0x7c, 0xa6, 0xb7, 0xa2}}
mm3 {uint64 = 0xea60000000000000, v2_int32 = {0x0, 0xea600000},
v4_int16 = {0x0, 0x0, 0x0, 0xea60}, v8_int8 = {0x0, 0x0, 0x0, 0x0,
0x0, 0x0,
0x60, 0xea}}
mm4 {uint64 = 0x924d692ca61be800, v2_int32 = {0xa61be800,
0x924d692c}, v4_int16 = {0xe800, 0xa61b, 0x692c, 0x924d}, v8_int8 =
{0x0,
0xe8, 0x1b, 0xa6, 0x2c, 0x69, 0x4d, 0x92}}
mm5 {uint64 = 0xea60000000000000, v2_int32 = {0x0, 0xea600000},
v4_int16 = {0x0, 0x0, 0x0, 0xea60}, v8_int8 = {0x0, 0x0, 0x0, 0x0,
0x0, 0x0,
0x60, 0xea}}
mm6 {uint64 = 0xa79ac42546f80000, v2_int32 = {0x46f80000,
0xa79ac425}, v4_int16 = {0x0, 0x46f8, 0xc425, 0xa79a}, v8_int8 = {0x0,
0x0, 0xf8, 0x46, 0x25, 0xc4, 0x9a, 0xa7}}
mm7 {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 0x0,
0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
--
Brian Brice
More information about the ffmpeg-devel
mailing list