File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1739,8 +1739,9 @@ static avifResult avifDecoderDataAllocateImagePlanes(const avifDecoderData * dat
17391739 // The tiled input images shall completely "cover" the reconstructed image grid canvas, ...
17401740
17411741 // Check for integer overflow before performing multiplications
1742- if ((tile -> image -> width > 0 && grid -> columns > UINT32_MAX / tile -> image -> width ) ||
1743- (tile -> image -> height > 0 && grid -> rows > UINT32_MAX / tile -> image -> height )) {
1742+ if (((uint64_t )tile -> image -> width * grid -> columns < grid -> outputWidth ) ||
1743+ ((uint64_t )tile -> image -> height * grid -> rows < grid -> outputHeight )) {
1744+
17441745 avifDiagnosticsPrintf (data -> diag ,
17451746 "Grid image dimensions would cause integer overflow" );
17461747 return AVIF_RESULT_INVALID_IMAGE_GRID ;
@@ -1760,8 +1761,8 @@ static avifResult avifDecoderDataAllocateImagePlanes(const avifDecoderData * dat
17601761 return AVIF_RESULT_INVALID_IMAGE_GRID ;
17611762 }
17621763
1763- if (((tile -> image -> width * (grid -> columns - 1 ) ) >= grid -> outputWidth ) ||
1764- ((tile -> image -> height * (grid -> rows - 1 ) ) >= grid -> outputHeight )) {
1764+ if (((uint64_t ) tile -> image -> width * (grid -> columns - 1 ) >= grid -> outputWidth ) ||
1765+ ((uint64_t ) tile -> image -> height * (grid -> rows - 1 ) >= grid -> outputHeight )) {
17651766 avifDiagnosticsPrintf (data -> diag ,
17661767 "Grid image tiles in the rightmost column and bottommost row do not overlap the reconstructed image grid canvas. See MIAF (ISO/IEC 23000-22:2019), Section 7.3.11.4.2, Figure 2" );
17671768 return AVIF_RESULT_INVALID_IMAGE_GRID ;
You can’t perform that action at this time.
0 commit comments