[FFmpeg-cvslog] avcodec/mjpegdec: Fix small picture upscale
Michael Niedermayer
git at videolan.org
Sat Jul 18 20:46:02 CEST 2015
ffmpeg | branch: release/2.7 | Michael Niedermayer <michaelni at gmx.at> | Tue Jun 30 01:19:30 2015 +0200| [a9c3b588af747521a88c57f528df9c740e4b1c6b] | committer: Michael Niedermayer
avcodec/mjpegdec: Fix small picture upscale
Fixes out of array access
Fixes: asan_heap-oob_1dd60fd_267_cov_2954683513_5baad44ca4702949724234e35c5bb341.jpg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 84afc6b70d24fc0bf686e43138c96cf60a9445fe)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9c3b588af747521a88c57f528df9c740e4b1c6b
---
libavcodec/mjpegdec.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 1ce3328..2c18a49 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2192,11 +2192,13 @@ the_end:
}
} else if (s->upscale_h[p] == 2) {
if (is16bit) {
- ((uint16_t*)line)[w - 1] =
- ((uint16_t*)line)[w - 2] = ((uint16_t*)line)[(w - 1) / 3];
+ ((uint16_t*)line)[w - 1] = ((uint16_t*)line)[(w - 1) / 3];
+ if (w > 1)
+ ((uint16_t*)line)[w - 2] = ((uint16_t*)line)[w - 1];
} else {
- line[w - 1] =
- line[w - 2] = line[(w - 1) / 3];
+ line[w - 1] = line[(w - 1) / 3];
+ if (w > 1)
+ line[w - 2] = line[w - 1];
}
for (index = w - 3; index > 0; index--) {
line[index] = (line[index / 3] + line[(index + 1) / 3] + line[(index + 2) / 3] + 1) / 3;
More information about the ffmpeg-cvslog
mailing list