[FFmpeg-devel] utils.c patch to avoid divide by zero

Ronald S. Bultje rsbultje
Wed Aug 26 15:51:06 CEST 2009


Hi,

On Wed, Aug 26, 2009 at 12:04 AM, Michael Niedermayer<michaelni at gmx.at> wrote:
> your patch is mangled besides, how and where does this bug happen
> i dont think the solution suggested in your patch is correct but i
> first need to know what the exact issue is

If this is the same as what I think it is, then it's triggered by
RTSP. I've emailed Luca & Luca about fixing it in rtsp.c (another bug)
but we haven't agreed on a solution yet. The bug occurs for any audio
stream with an unknown payload / codecID.

Ronald

rtsp://media2.thomsonlearning.com:554/sw/sbs/lamb_marketing8e/high_speed/cowgirl_320.mov

Program received signal EXC_ARITHMETIC, Arithmetic exception.
[Switching to process 34851 thread 0x550f]
0x96fc2eeb in __divdi3 ()
(gdb) bt
#0  0x96fc2eeb in __divdi3 ()
#1  0x00427505 in av_rescale_rnd (a=0, b=0, c=0,
rnd=AV_ROUND_NEAR_INF) at libavutil/mathematics.c:71
#2  0x004279a3 in av_rescale (a=0, b=0, c=0) at libavutil/mathematics.c:111
#3  0x0008caf1 in finalize_packet (s=0x1031c00, pkt=0xb012b804,
timestamp=0) at libavformat/rtpdec.c:391
#4  0x0008cfb4 in rtp_parse_packet (s=0x1031c00, pkt=0xb012b804,
buf=0xb0127c50 "", len=1279) at libavformat/rtpdec.c:552
#5  0x0008179b in rtsp_read_packet (s=0x1032600, pkt=0xb012b804) at
libavformat/rtsp.c:1554
#6  0x0000dd43 in av_read_packet (s=0x1032600, pkt=0xb012b804) at
libavformat/utils.c:552
#7  0x0000fa75 in av_read_frame_internal (s=0x1032600, pkt=0xb012bccc)
at libavformat/utils.c:970
#8  0x0001381b in av_find_stream_info (ic=0x1032600) at libavformat/utils.c:2091
#9  0x00007285 in decode_thread (arg=0xdbce000) at ffplay.c:1934
#10 0x00a9924c in SDL_RunThread ()
#11 0x00ad663b in RunThread ()
#12 0x97398155 in _pthread_start ()
#13 0x97398012 in thread_start ()
(gdb) frame 3
#3  0x0008caf1 in finalize_packet (s=0x1031c00, pkt=0xb012b804,
timestamp=0) at libavformat/rtpdec.c:391
391             addend = av_rescale(s->last_rtcp_ntp_time -
s->first_rtcp_ntp_time, s->st->time_base.den,
(uint64_t)s->st->time_base.num << 32);
(gdb) list
386             int delta_timestamp;
387
388             /* compute pts from timestamp with received ntp_time */
389             delta_timestamp = timestamp - s->last_rtcp_timestamp;
390             /* convert to the PTS timebase */
391             addend = av_rescale(s->last_rtcp_ntp_time -
s->first_rtcp_ntp_time, s->st->time_base.den,
(uint64_t)s->st->time_base.num << 32);
392             pkt->pts = addend + delta_timestamp;
393         }
394     }
395
(gdb) print s->st->time_base.den
$1 = 0
(gdb) print s->st->time_base.num
$2 = 0
(gdb) print *s->st->codec
$3 = {
[..]
 codec_type = CODEC_TYPE_AUDIO,
 codec_id = CODEC_ID_NONE,
[..]
}



More information about the ffmpeg-devel mailing list