[FFmpeg-devel] [PATCH 1/7] avcodec/pgxdec: Make better use of size check

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Apr 24 07:39:41 EEST 2022


Each of the three calls to pgx_get_number() consumes at least two bytes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/pgxdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/pgxdec.c b/libavcodec/pgxdec.c
index 899e7a9994..154a683b4f 100644
--- a/libavcodec/pgxdec.c
+++ b/libavcodec/pgxdec.c
@@ -56,9 +56,8 @@ static int pgx_decode_header(AVCodecContext *avctx, GetByteContext *g,
 {
     int byte;
 
-    if (bytestream2_get_bytes_left(g) < 6) {
+    if (bytestream2_get_bytes_left(g) < 12)
         return AVERROR_INVALIDDATA;
-    }
 
     bytestream2_skip(g, 6);
 
-- 
2.32.0



More information about the ffmpeg-devel mailing list