[FFmpeg-cvslog] avformat/bit: check that pkt->size is 10 in write_packet

Andreas Cadhalpun git at videolan.org
Sat Mar 21 02:30:07 CET 2015


ffmpeg | branch: release/2.5 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Thu Feb 26 21:38:50 2015 +0100| [0540d5c5fc1b573cac86c641c338ec1cb7a5e8ea] | committer: Michael Niedermayer

avformat/bit: check that pkt->size is 10 in write_packet

Ohter packet sizes are not supported by this muxer.

This avoids a null pointer dereference of pkt->data.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit eeda2c3de8a8484d9e7d1e47ac836bec850b31fc)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0540d5c5fc1b573cac86c641c338ec1cb7a5e8ea
---

 libavformat/bit.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/bit.c b/libavformat/bit.c
index 7b807b9..5d05da0 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -133,6 +133,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     GetBitContext gb;
     int i;
 
+    if (pkt->size != 10)
+        return AVERROR(EINVAL);
+
     avio_wl16(pb, SYNC_WORD);
     avio_wl16(pb, 8 * 10);
 



More information about the ffmpeg-cvslog mailing list