[FFmpeg-devel] [PATCH 3/3] avformat/oggparseogm: Check lb against psize

Michael Niedermayer michael at niedermayer.cc
Fri Mar 9 03:37:54 EET 2018


No testcase, this was found during code review

Found-by: Matt Wolenetz <wolenetz at google.com>

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/oggparseogm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
index 4b4edf26ca..a07453760b 100644
--- a/libavformat/oggparseogm.c
+++ b/libavformat/oggparseogm.c
@@ -176,6 +176,9 @@ ogm_packet(AVFormatContext *s, int idx)
         os->pflags |= AV_PKT_FLAG_KEY;
 
     lb = ((*p & 2) << 1) | ((*p >> 6) & 3);
+    if (os->psize < lb + 1)
+        return AVERROR_INVALIDDATA;
+
     os->pstart += lb + 1;
     os->psize -= lb + 1;
 
-- 
2.16.2



More information about the ffmpeg-devel mailing list