Message ID | 20200716224358.23954-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | d54c24acde88a214489d5ef410982eedac7ffc29 |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/tiff: Fix default white level | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Fri, Jul 17, 2020 at 12:43:57AM +0200, Michael Niedermayer wrote: > According to the spec bits per sample should be used > > Fix invalid shift with bpp=32 > Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' > Fixes: 23507/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4815432665268224 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/tiff.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) will apply patchset [...]
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 18b327e800..e0733f54d9 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1883,8 +1883,14 @@ again: if (is_dng) { int bps; + if (s->bpp % s->bppcount) + return AVERROR_INVALIDDATA; + bps = s->bpp / s->bppcount; + if (bps < 8 || bps > 32) + return AVERROR_INVALIDDATA; + if (s->white_level == 0) - s->white_level = (1 << s->bpp) - 1; /* Default value as per the spec */ + s->white_level = (1LL << bps) - 1; /* Default value as per the spec */ if (s->white_level <= s->black_level) { av_log(avctx, AV_LOG_ERROR, "BlackLevel (%"PRId32") must be less than WhiteLevel (%"PRId32")\n", @@ -1892,11 +1898,6 @@ again: return AVERROR_INVALIDDATA; } - if (s->bpp % s->bppcount) - return AVERROR_INVALIDDATA; - bps = s->bpp / s->bppcount; - if (bps < 8 || bps > 32) - return AVERROR_INVALIDDATA; if (s->planar) return AVERROR_PATCHWELCOME; }
According to the spec bits per sample should be used Fix invalid shift with bpp=32 Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 23507/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4815432665268224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/tiff.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)