The first line of function alphaBlend(bytes memory backBgr, bytes memory foreAbgr, uint256 width, Rectangle memory rect) has a flaw, where the fgStride calculation will revert because Rectangle uses uint8, and xMin and xMax, when multiplied together, could be larger than a uint8.
For example, if xMax is 64, and xMin is 64, multiplication would overrun since the value will equal 256.
This line:
uint256 fgStride = (rect.xMax - rect.xMin) * 4;
Should be:
uint256 fgStride = uint256(rect.xMax - rect.xMin) * 4;
The first line of
function alphaBlend(bytes memory backBgr, bytes memory foreAbgr, uint256 width, Rectangle memory rect)has a flaw, where thefgStridecalculation will revert becauseRectangleusesuint8, andxMinandxMax, when multiplied together, could be larger than auint8.For example, if
xMaxis64, andxMinis64, multiplication would overrun since the value will equal256.This line:
Should be: