OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af0544c
)
avcodec/mjpegdec: Check number of components for JPEG-LS
author
Michael Niedermayer
<michaelni@gmx.at>
Wed, 4 Feb 2015 19:48:30 +0000
(20:48 +0100)
committer
Michael Niedermayer
<michaelni@gmx.at>
Wed, 4 Feb 2015 20:27:25 +0000
(21:27 +0100)
Fixes out of array accesses
Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit
fabbfaa095660982cc0bc63242c459561fa37037
)
Conflicts:
libavcodec/mjpegdec.c
libavcodec/mjpegdec.c
patch
|
blob
|
history
diff --git
a/libavcodec/mjpegdec.c
b/libavcodec/mjpegdec.c
index
748107d
..
f12210a
100644
(file)
--- a/
libavcodec/mjpegdec.c
+++ b/
libavcodec/mjpegdec.c
@@
-471,9
+471,12
@@
unk_pixfmt:
}
if (s->ls) {
s->upscale_h = s->upscale_v = 0;
- if (s->nb_components
> 1)
+ if (s->nb_components
== 3) {
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
- else if (s->bits <= 8)
+ } else if (s->nb_components != 1) {
+ av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components);
+ return AVERROR_PATCHWELCOME;
+ } else if (s->bits <= 8)
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
else
s->avctx->pix_fmt = AV_PIX_FMT_GRAY16;