Message ID | 20211223211527.20408-2-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/5] avcodec/targa: Check input size for uncompressed TGA before allocation | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | fail | Make fate failed |
Michael Niedermayer: > Fixes: left shift of 255 by 24 places cannot be represented in type 'int' > Fixes: 42766/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5142826105569280 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/cdgraphics.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c > index 06f83920943..f54ce5a05c0 100644 > --- a/libavcodec/cdgraphics.c > +++ b/libavcodec/cdgraphics.c > @@ -122,7 +122,7 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low) > r = ((color >> 8) & 0x000F) * 17; > g = ((color >> 4) & 0x000F) * 17; > b = ((color ) & 0x000F) * 17; > - palette[i + array_offset] = cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; > + palette[i + array_offset] = (unsigned)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; > } > cc->frame->palette_has_changed = 1; > } > LGTM. Although I'd prefer uint32_t here, as this is exactly what is needed and it fits the type of palette. - Andreas
On Thu, Dec 23, 2021 at 10:45:47PM +0100, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Fixes: left shift of 255 by 24 places cannot be represented in type 'int' > > Fixes: 42766/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5142826105569280 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavcodec/cdgraphics.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c > > index 06f83920943..f54ce5a05c0 100644 > > --- a/libavcodec/cdgraphics.c > > +++ b/libavcodec/cdgraphics.c > > @@ -122,7 +122,7 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low) > > r = ((color >> 8) & 0x000F) * 17; > > g = ((color >> 4) & 0x000F) * 17; > > b = ((color ) & 0x000F) * 17; > > - palette[i + array_offset] = cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; > > + palette[i + array_offset] = (unsigned)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; > > } > > cc->frame->palette_has_changed = 1; > > } > > > > LGTM. Although I'd prefer uint32_t here, as this is exactly what is > needed and it fits the type of palette. will apply32_t thx [...]
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index 06f83920943..f54ce5a05c0 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -122,7 +122,7 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low) r = ((color >> 8) & 0x000F) * 17; g = ((color >> 4) & 0x000F) * 17; b = ((color ) & 0x000F) * 17; - palette[i + array_offset] = cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; + palette[i + array_offset] = (unsigned)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; } cc->frame->palette_has_changed = 1; }
Fixes: left shift of 255 by 24 places cannot be represented in type 'int' Fixes: 42766/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5142826105569280 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/cdgraphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)