[FFmpeg-devel] [PATCH] rmdec: make sure we actually have a buffer before writing into it

Reimar Döffinger Reimar.Doeffinger
Sat Sep 12 22:27:45 CEST 2009


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;
     }
 
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...).



More information about the ffmpeg-devel mailing list