[FFmpeg-cvslog] matroskadec: add assert on lack of overflow in pkt_size+offset

Michael Niedermayer git at videolan.org
Fri Jun 15 01:45:29 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jun 15 01:35:52 2012 +0200| [59c122b3b0a00808e3c4f534927755d89e7baa62] | committer: Michael Niedermayer

matroskadec: add assert on lack of overflow in pkt_size+offset

currently a overflow there should be impossible but future changes to
the code could easily introduce a bug that no longer limits the 2
values sufficiently so better protect it via av_assert.

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

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

 libavformat/matroskadec.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 74df076..aaeff21 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2053,6 +2053,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
                     offset = matroska_decode_buffer(&pkt_data,&pkt_size, track);
                     if (offset < 0)
                         continue;
+                    av_assert0(offset + pkt_size >= pkt_size);
                 }
 
                 pkt = av_mallocz(sizeof(AVPacket));



More information about the ffmpeg-cvslog mailing list