Fixed: Reading gif, off-by-one

--HG--
branch : develop
This commit is contained in:
Nimetu 2017-10-16 19:38:35 +03:00
parent d721c661ea
commit 81adb6c787

View file

@ -215,9 +215,6 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f )
for (uint32 x = 0; x < width; x++) for (uint32 x = 0; x < width; x++)
{ {
srcOffset++;
dstOffset+= dstChannels;
uint32 index = curFrame->RasterBits[srcOffset]; uint32 index = curFrame->RasterBits[srcOffset];
if ((sint32)index != transparency) if ((sint32)index != transparency)
@ -250,6 +247,9 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f )
_Data[0][dstOffset+1] = g; _Data[0][dstOffset+1] = g;
_Data[0][dstOffset+2] = b; _Data[0][dstOffset+2] = b;
_Data[0][dstOffset+3] = a; _Data[0][dstOffset+3] = a;
srcOffset++;
dstOffset+= dstChannels;
} // x loop } // x loop
} // y loop } // y loop
} // pass loop } // pass loop
@ -262,9 +262,6 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f )
uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels; uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels;
for (uint32 x = 0; x < width; x++) for (uint32 x = 0; x < width; x++)
{ {
srcOffset++;
dstOffset+= dstChannels;
uint32 index = curFrame->RasterBits[srcOffset]; uint32 index = curFrame->RasterBits[srcOffset];
if ((sint32)index != transparency) if ((sint32)index != transparency)
@ -297,6 +294,9 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f )
_Data[0][dstOffset+1] = g; _Data[0][dstOffset+1] = g;
_Data[0][dstOffset+2] = b; _Data[0][dstOffset+2] = b;
_Data[0][dstOffset+3] = a; _Data[0][dstOffset+3] = a;
srcOffset++;
dstOffset+= dstChannels;
} // x loop } // x loop
} // y loop } // y loop
} }