Open wantehchang opened 4 years ago
The yuvRowBytes
and alphaRowBytes
members of avifImage
should ideally also be declared as size_t,
because they are often multiplied with a row index variable. DeclaringyuvRowBytes
and alphaRowBytes
as size_t
ensures those multiplications are done in the size_t
type.
But this change will break backward compatibility.
avifImageAllocatePlanes()
uses theint
type for all local variables, including the allocation sizesfullSize
anduvSize
. This prevents a grid image to be larger than, say, 64K x 64K on 64-bit platforms.Specifically, there are three allocation sizes:
Note: the allocation of
image->alphaPlane
could use the local variablefullSize
.The allocation sizes should be calculated using the
size_t
type instead. In addition, we need to make sure the multiplications do not overflowsize_t
.