Skip to content

Commit 04fe10b

Browse files
committed
avifjpeg.c: check for uint32_t overflow before add
Bug: b:406974988
1 parent 5572e9c commit 04fe10b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/shared/avifjpeg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static uint16_t avifJPEGReadUint16LittleEndian(const uint8_t * src)
310310
// Reads 'numBytes' at 'offset', stores them in 'bytes' and increases 'offset'.
311311
static avifBool avifJPEGReadBytes(const avifROData * data, uint8_t * bytes, uint32_t * offset, uint32_t numBytes)
312312
{
313-
if (data->size < (*offset + numBytes)) {
313+
if ((UINT32_MAX - *offset) < numBytes || data->size < (*offset + numBytes)) {
314314
return AVIF_FALSE;
315315
}
316316
memcpy(bytes, &data->data[*offset], numBytes);

0 commit comments

Comments
 (0)