summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-03-14 01:34:14 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-03-16 01:04:35 +0100
commitcfa10e11be4c17fdff0c77cba7c0b3d6ea99acea (patch)
treec569c168fa31ff04ec319915fca0d3a4dc7f973a /libavcodec/tiff.c
parent58e9c7f4a2fdce4bc5531a618c142f27117c5145 (diff)
avcodec/tiff: Check palette shift
Fixes multiple runtime error: shift exponent 792 is too large for 32-bit type 'unsigned int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 456da5142b..0be7be7528 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -996,6 +996,11 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
bytestream2_skip(&pal_gb[2], count / 3 * off * 2);
off = (type_sizes[type] - 1) << 3;
+ if (off > 31U) {
+ av_log(s->avctx, AV_LOG_ERROR, "palette shift %d is out of range\n", off);
+ return AVERROR_INVALIDDATA;
+ }
+
for (i = 0; i < count / 3; i++) {
uint32_t p = 0xFF000000;
p |= (ff_tget(&pal_gb[0], type, s->le) >> off) << 16;