mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/tiff: Check value on positive signed targets
Fixes: CID1604593 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 66d6b8033b4bf8e9b33f26729c4ab9f9b328c5a2) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
333a623915
commit
3e0da83058
@ -1297,9 +1297,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
|||||||
s->is_thumbnail = (value != 0);
|
s->is_thumbnail = (value != 0);
|
||||||
break;
|
break;
|
||||||
case TIFF_WIDTH:
|
case TIFF_WIDTH:
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->width = value;
|
s->width = value;
|
||||||
break;
|
break;
|
||||||
case TIFF_HEIGHT:
|
case TIFF_HEIGHT:
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->height = value;
|
s->height = value;
|
||||||
break;
|
break;
|
||||||
case TIFF_BPP:
|
case TIFF_BPP:
|
||||||
@ -1431,12 +1435,18 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
|||||||
s->tile_byte_counts_offset = off;
|
s->tile_byte_counts_offset = off;
|
||||||
break;
|
break;
|
||||||
case TIFF_TILE_LENGTH:
|
case TIFF_TILE_LENGTH:
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->tile_length = value;
|
s->tile_length = value;
|
||||||
break;
|
break;
|
||||||
case TIFF_TILE_WIDTH:
|
case TIFF_TILE_WIDTH:
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->tile_width = value;
|
s->tile_width = value;
|
||||||
break;
|
break;
|
||||||
case TIFF_PREDICTOR:
|
case TIFF_PREDICTOR:
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->predictor = value;
|
s->predictor = value;
|
||||||
break;
|
break;
|
||||||
case TIFF_SUB_IFDS:
|
case TIFF_SUB_IFDS:
|
||||||
@ -1581,12 +1591,18 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_T4OPTIONS:
|
case TIFF_T4OPTIONS:
|
||||||
if (s->compr == TIFF_G3)
|
if (s->compr == TIFF_G3) {
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->fax_opts = value;
|
s->fax_opts = value;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TIFF_T6OPTIONS:
|
case TIFF_T6OPTIONS:
|
||||||
if (s->compr == TIFF_G4)
|
if (s->compr == TIFF_G4) {
|
||||||
|
if (value > INT_MAX)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
s->fax_opts = value;
|
s->fax_opts = value;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#define ADD_METADATA(count, name, sep)\
|
#define ADD_METADATA(count, name, sep)\
|
||||||
if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
|
if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user