Browse code

avcodec/dpx: Move need_align to act per line

Fixes out of array read
Fixes: 61cf123c081ee2bb774d307c75bdb99e/asan_heap-oob_1224f76_5546_bee833ffae73f752b489b9eeaac52db7.dpx

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c8aaae8e0f1519bc99bd717ea3067c9cfdb68def)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2015/11/14 22:29:02
Showing 1 changed files
... ...
@@ -348,11 +348,11 @@ static int decode_frame(AVCodecContext *avctx,
348 348
                 // For 12 bit, ignore alpha
349 349
                 if (elements == 4)
350 350
                     buf += 2;
351
-                // Jump to next aligned position
352
-                buf += need_align;
353 351
             }
354 352
             for (i = 0; i < 3; i++)
355 353
                 ptr[i] += p->linesize[i];
354
+            // Jump to next aligned position
355
+            buf += need_align;
356 356
         }
357 357
         break;
358 358
     case 16: