diff mbox series

[FFmpeg-devel,3/3] avcodec/cpia: Fix missing src_size update

Message ID 20210621212544.15449-3-michael@niedermayer.cc
State Accepted
Commit cea05864e65db9a2dc8af82b2c63fb8f03c5f876
Headers show
Series [FFmpeg-devel,1/3] avcodec/clearvideo: Check tile_size to be not too large | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer June 21, 2021, 9:25 p.m. UTC
Fixes: out of array read
Fixes: 35210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CPIA_fuzzer-5669199688105984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/cpia.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c
index d88bd1aae7..a2ae16ec2c 100644
--- a/libavcodec/cpia.c
+++ b/libavcodec/cpia.c
@@ -111,6 +111,7 @@  static int cpia_decode_frame(AVCodecContext *avctx,
         // Read line length, two byte little endian
         linelength = AV_RL16(src);
         src += 2;
+        src_size -= 2;
 
         if (src_size < linelength) {
             frame->decode_error_flags = FF_DECODE_ERROR_INVALID_BITSTREAM;