[FFmpeg-cvslog] avcodec/rawdec: Use linesize in b64a

Michael Niedermayer git at videolan.org
Fri Jan 31 01:13:53 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan  1 22:32:04 2020 +0100| [2b5b9d5dac9a3525d7330662724c0e9045078bfb] | committer: Michael Niedermayer

avcodec/rawdec: Use linesize in b64a

Fixes: out of array access
Fixes: 19750/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RAWVIDEO_fuzzer-5074834119983104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/rawdec.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 0b2d8708e6..a110a690f5 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -467,10 +467,13 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
         avctx->pix_fmt   == AV_PIX_FMT_RGBA64BE) {
         uint8_t *dst = frame->data[0];
         uint64_t v;
-        int x;
-        for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) {
-            v = AV_RB64(&dst[x]);
-            AV_WB64(&dst[x], v << 16 | v >> 48);
+        int x, y;
+        for (y = 0; y < avctx->height; y++) {
+            for (x = 0; x >> 3 < avctx->width; x += 8) {
+                v = AV_RB64(&dst[x]);
+                AV_WB64(&dst[x], v << 16 | v >> 48);
+            }
+            dst += frame->linesize[0];
         }
     }
 



More information about the ffmpeg-cvslog mailing list