From 7225aecbb30015cd60b2fd8a4520726c343381e8 Mon Sep 17 00:00:00 2001 From: Nicolas Cellier Date: Thu, 21 Nov 2019 23:33:46 +0100 Subject: [PATCH] Attempt to Fix Issue #447 - BitBlt signed int overflow Generate the plugin from VMMaker.oscog-nice.2587 which declare `dx dy sx sy` as sqInt rather than int. --- src/plugins/BitBltPlugin/BitBltPlugin.c | 64 ++++++++++++------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/plugins/BitBltPlugin/BitBltPlugin.c b/src/plugins/BitBltPlugin/BitBltPlugin.c index cec51c26ce..1cf07d37e4 100644 --- a/src/plugins/BitBltPlugin/BitBltPlugin.c +++ b/src/plugins/BitBltPlugin/BitBltPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-nice.2575 uuid: 7833e19b-d77a-4ead-af27-7744aa426280 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-nice.2587 uuid: 0f96b8ad-4155-4a08-93e1-66bd1fcfff72 from - BitBltSimulation VMMaker.oscog-nice.2575 uuid: 7833e19b-d77a-4ead-af27-7744aa426280 + BitBltSimulation VMMaker.oscog-nice.2587 uuid: 0f96b8ad-4155-4a08-93e1-66bd1fcfff72 */ -static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-nice.2575 uuid: 7833e19b-d77a-4ead-af27-7744aa426280 " __DATE__ ; +static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-nice.2587 uuid: 0f96b8ad-4155-4a08-93e1-66bd1fcfff72 " __DATE__ ; @@ -252,8 +252,8 @@ static const int ditherValues16[32] = { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; static sqInt dstBitShift; -static int dx; -static int dy; +static sqInt dx; +static sqInt dy; static usqInt endOfDestination; static usqInt endOfSource; static unsigned char * gammaLookupTable; @@ -359,9 +359,9 @@ static int maskTable[33] = { }; static const char *moduleName = #ifdef SQUEAK_BUILTIN_PLUGIN - "BitBltPlugin VMMaker.oscog-nice.2575 (i)" + "BitBltPlugin VMMaker.oscog-nice.2587 (i)" #else - "BitBltPlugin VMMaker.oscog-nice.2575 (e)" + "BitBltPlugin VMMaker.oscog-nice.2587 (e)" #endif ; static sqInt noHalftone; @@ -386,8 +386,8 @@ static int sourceWidth; static sqInt sourceX; static sqInt sourceY; static sqInt srcBitShift; -static int sx; -static int sy; +static sqInt sx; +static sqInt sy; static unsigned char * ungammaLookupTable; static int (*unlockSurfaceFn)(sqIntptr_t, int, int, int, int); static sqInt vDir; @@ -638,19 +638,19 @@ alphaSourceBlendBits16(void) int deltaX; int deltaY; unsigned int destWord; - int ditherBase; - int ditherIndex; + sqInt ditherBase; + sqInt ditherIndex; int ditherThreshold; sqInt dstIndex; unsigned int dstMask; sqInt dstValue; sqInt dstValue1; - int dstY; + sqInt dstY; unsigned int sourceWord; unsigned int srcAlpha; sqInt srcIndex; - int srcShift; - int srcY; + sqInt srcShift; + sqInt srcY; /* This particular method should be optimized in itself */ @@ -784,11 +784,11 @@ alphaSourceBlendBits32(void) int deltaY; unsigned int destWord; sqInt dstIndex; - int dstY; + sqInt dstY; unsigned int sourceWord; unsigned int srcAlpha; sqInt srcIndex; - int srcY; + sqInt srcY; /* This particular method should be optimized in itself */ @@ -886,7 +886,7 @@ alphaSourceBlendBits8(void) sqInt dstIndex; unsigned int dstMask; sqInt dstValue; - int dstY; + sqInt dstY; sqInt mapperFlags; unsigned int *mappingTable; sqInt pv; @@ -894,7 +894,7 @@ alphaSourceBlendBits8(void) unsigned int srcAlpha; sqInt srcIndex; sqInt srcShift; - int srcY; + sqInt srcY; static unsigned int theTable[256] = { 0x0, 0xFF000001, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, @@ -1976,7 +1976,7 @@ copyLoop(void) unsigned int thisWord; int unskew; sqInt word; - int y; + sqInt y; /* unskew is a bitShift and MUST remain signed, while skewMask is unsigned. */ @@ -5749,18 +5749,18 @@ rgbComponentAlpha16(void) int deltaX; int deltaY; unsigned int destWord; - int ditherBase; - int ditherIndex; + sqInt ditherBase; + sqInt ditherIndex; int ditherThreshold; sqInt dstIndex; unsigned int dstMask; sqInt dstValue; - int dstY; + sqInt dstY; unsigned int sourceWord; unsigned int srcAlpha; sqInt srcIndex; - int srcShift; - int srcY; + sqInt srcShift; + sqInt srcY; /* So we can pre-decrement */ @@ -5869,11 +5869,11 @@ rgbComponentAlpha32(void) int deltaY; unsigned int destWord; register sqIntptr_t dstIndex; - int dstY; + sqInt dstY; unsigned int sourceWord; unsigned int srcAlpha; register sqIntptr_t srcIndex; - int srcY; + sqInt srcY; /* This particular method should be optimized in itself */ @@ -6066,7 +6066,7 @@ rgbComponentAlpha8(void) sqInt dstIndex; unsigned int dstMask; sqInt dstValue; - int dstY; + sqInt dstY; sqInt mapperFlags; unsigned int *mappingTable; sqInt pv; @@ -6074,7 +6074,7 @@ rgbComponentAlpha8(void) unsigned int srcAlpha; sqInt srcIndex; sqInt srcShift; - int srcY; + sqInt srcY; static unsigned int theTable[256] = { 0x0, 0xFF000001, 0xFFFFFFFF, 0xFF808080, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFF202020, 0xFF404040, 0xFF606060, 0xFF9F9F9F, 0xFFBFBFBF, 0xFFDFDFDF, @@ -7874,16 +7874,16 @@ warpPickSmoothPixelsxDeltahyDeltahxDeltavyDeltavsourceMapsmoothingdstShiftInc(sq unsigned int sourceWord; sqInt srcIndex; sqInt val; - int x; + sqInt x; sqInt x1; sqInt xdh; sqInt xdv; - int xx; - int y; + sqInt xx; + sqInt y; sqInt y1; sqInt ydh; sqInt ydv; - int yy; + sqInt yy; /* nope - too much stuff in here */