[FFmpeg-devel] [PATCH] rmdec: make sure we actually have a buffer before writing into it
Kostya
kostya.shishkov
Sun Sep 13 09:33:34 CEST 2009
On Sat, Sep 12, 2009 at 10:27:45PM +0200, Reimar D?ffinger wrote:
> rm_assemble_video_frame may write into vst->pkt.data even though that
> one is NULL because we just returned a packet and have not yet allocated
> a new one.
> There are loads of ways to fix that, and possibly even some better/more
> error resilient ones, but since I don't know the rm format that well I
> propose this rather simple one, which sets vst->slices to 0 in addition
> to vst->pkt.size/data and thus takes advantage of an existing check.
> Index: libavformat/rmdec.c
> ===================================================================
> --- libavformat/rmdec.c (revision 19824)
> +++ libavformat/rmdec.c (working copy)
> @@ -637,6 +637,7 @@
> pkt->size = vst->videobufpos + 8*(vst->cur_slice - vst->slices);
> pkt->pts = AV_NOPTS_VALUE;
> pkt->pos = vst->pktpos;
> + vst->slices = 0;
> return 0;
> }
Hmm, that does not seem correct since packet is allocated when first
part of it (i.e. slice number = 1) is seen. If we don't get it, packet
will be corrupted.
> Sample file:
> http://www.archive.org/download/JustaSpa1937/JustaSpa1937_64kb.rm with
> MAX_STREAMS increased and mplayer and -demuxer lavf (I do not know yet
> how to reproduce with ffmpeg or ffplay due to too many other issues I
> admit, though I am fairly sure this is not caused by MPlayer...).
I'll look at it.
More information about the ffmpeg-devel
mailing list