Fix #9487: GIFLoad array subscript below array bounds
Recently enabled variable range propagation enables GCC to among others analyze whether array subscript is in a valid range. While being quite useful this particular feature also happens to produce false positives. This is merely a workaround to make compiler happy. The actual reason why compiler is reporting false positive is that array is indexed with a signed integer and it is not clear for compiler what value it may have due to it being a member of the class and and external procedure being invoked between its initialization and usage.
This commit is contained in:
@@ -339,7 +339,7 @@ GIFLoad::ReadGIFImageData()
|
|||||||
goto bad_end;
|
goto bad_end;
|
||||||
|
|
||||||
//memcpy(newEntry, fOldCode, fOldCodeLength);
|
//memcpy(newEntry, fOldCode, fOldCodeLength);
|
||||||
for (int x = 0; x < fOldCodeLength; x++) {
|
for (unsigned int x = 0; x < fOldCodeLength; x++) {
|
||||||
newEntry[x] = fOldCode[x];
|
newEntry[x] = fOldCode[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +347,7 @@ GIFLoad::ReadGIFImageData()
|
|||||||
newEntry[fOldCodeLength] = *fTable[fNewCode];
|
newEntry[fOldCodeLength] = *fTable[fNewCode];
|
||||||
} else { // Does not exist in table
|
} else { // Does not exist in table
|
||||||
//memcpy(newEntry, fOldCode, fOldCodeLength);
|
//memcpy(newEntry, fOldCode, fOldCodeLength);
|
||||||
for (int x = 0; x < fOldCodeLength; x++) {
|
for (unsigned int x = 0; x < fOldCodeLength; x++) {
|
||||||
newEntry[x] = fOldCode[x];
|
newEntry[x] = fOldCode[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ GIFLoad::ReadGIFImageData()
|
|||||||
fTable[fNextCode] = MemblockAllocate(fOldCodeLength + 1);
|
fTable[fNextCode] = MemblockAllocate(fOldCodeLength + 1);
|
||||||
|
|
||||||
//memcpy(fTable[fNextCode], newEntry, fOldCodeLength + 1);
|
//memcpy(fTable[fNextCode], newEntry, fOldCodeLength + 1);
|
||||||
for (int x = 0; x < fOldCodeLength + 1; x++) {
|
for (unsigned int x = 0; x < fOldCodeLength + 1; x++) {
|
||||||
fTable[fNextCode][x] = newEntry[x];
|
fTable[fNextCode][x] = newEntry[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class GIFLoad {
|
|||||||
int fPass, fRow, fWidth, fHeight;
|
int fPass, fRow, fWidth, fHeight;
|
||||||
|
|
||||||
unsigned char fOldCode[4096];
|
unsigned char fOldCode[4096];
|
||||||
int fOldCodeLength;
|
unsigned int fOldCodeLength;
|
||||||
short fNewCode;
|
short fNewCode;
|
||||||
int fBits, fMaxCode, fCodeSize;
|
int fBits, fMaxCode, fCodeSize;
|
||||||
short fClearCode, fEndCode, fNextCode;
|
short fClearCode, fEndCode, fNextCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user