mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2025-02-12 23:50:59 +00:00
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>
This commit is contained in:
parent
58e9c7f4a2
commit
cfa10e11be
@ -996,6 +996,11 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
|||||||
bytestream2_skip(&pal_gb[2], count / 3 * off * 2);
|
bytestream2_skip(&pal_gb[2], count / 3 * off * 2);
|
||||||
|
|
||||||
off = (type_sizes[type] - 1) << 3;
|
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++) {
|
for (i = 0; i < count / 3; i++) {
|
||||||
uint32_t p = 0xFF000000;
|
uint32_t p = 0xFF000000;
|
||||||
p |= (ff_tget(&pal_gb[0], type, s->le) >> off) << 16;
|
p |= (ff_tget(&pal_gb[0], type, s->le) >> off) << 16;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user