[ffmpeg-devel] [BUG] utils.c:av_dup_packet. Segmentation fault

I. Po yyymmmm
Thu Jul 27 08:29:19 CEST 2006

When I run ff with any input file with 2 output files, where both of
them contain video stream, I have crash with SEGV.

gdb log:

#0  0xb7e95abf in memcpy () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7e95abf in memcpy () from /lib/tls/libc.so.6
#1  0x0805fb5b in av_dup_packet (pkt=0x8425560) at utils.c:257
#2  0x08064fa9 in av_interleave_packet_per_dts (s=0x8421070,
out=0xbf8ad870, pkt=0xbf8ad9b0, flush=0) at utils.c:2422
#3  0x080651e5 in av_interleave_packet (s=0x8421070, out=0xbf8ad870,
in=0xbf8ad9b0, flush=0) at utils.c:2473
#4  0x0806527e in av_interleaved_write_frame (s=0x8421070,
pkt=0xbf8ad9b0) at utils.c:2506
#5  0x08055655 in write_frame (s=0x8421070, pkt=0xbf8ad9b0,
avctx=0x8421fe0, bsfc=0x0) at ffmpeg.c:467
#6  0x080583fe in output_packet (ist=0x84c59c0, ist_index=0,
ost_table=0x842be70, nb_ostreams=3, pkt=0xbf8adce0)
    at ffmpeg.c:1347
#7  0x0805a49c in av_encode (output_files=0x8395580,
nb_output_files=2, input_files=0x8395480, nb_input_files=1,
    stream_maps=0x83955e0, nb_stream_maps=0) at ffmpeg.c:2010
#8  0x0805ef44 in main (argc=15, argv=0xbf8ae204) at ffmpeg.c:4271
(gdb) frame 1
#1  0x0805fb5b in av_dup_packet (pkt=0x8425560) at utils.c:257
257             memcpy(data, pkt->data, pkt->size);
(gdb) list
252                 return AVERROR_NOMEM;
253             data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
254             if (!data) {
255                 return AVERROR_NOMEM;
256             }
257             memcpy(data, pkt->data, pkt->size);
258             memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
259             pkt->data = data;
260             pkt->destruct = av_destruct_packet;
261         }
(gdb) print data
$1 = (uint8_t *) 0xb7da9020 ""
(gdb) print  pkt->data
$2 = (uint8_t *) 0x0
(gdb) print  pkt->size
$3 = 145800

ff's arguments in this case was: ./ffmpeg -y -i 1.avi -sameq -vcodec
copy -acodec copy -f mpeg2video 1 -f m4v 2
I tryed to run ff several times with different output args, result was
the same. Input files contained streams in mpeg2, mpeg4, h264 formats.
ff crashed in the same place in code.

More information about the ffmpeg-devel mailing list