From 81adb6c78766367368f5e001f4ceade7b85a5dc6 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 16 Oct 2017 19:38:35 +0300 Subject: [PATCH] Fixed: Reading gif, off-by-one --HG-- branch : develop --- code/nel/src/misc/bitmap_gif.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/nel/src/misc/bitmap_gif.cpp b/code/nel/src/misc/bitmap_gif.cpp index 5b964998a..653942d08 100644 --- a/code/nel/src/misc/bitmap_gif.cpp +++ b/code/nel/src/misc/bitmap_gif.cpp @@ -215,9 +215,6 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) for (uint32 x = 0; x < width; x++) { - srcOffset++; - dstOffset+= dstChannels; - uint32 index = curFrame->RasterBits[srcOffset]; if ((sint32)index != transparency) @@ -250,6 +247,9 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) _Data[0][dstOffset+1] = g; _Data[0][dstOffset+2] = b; _Data[0][dstOffset+3] = a; + + srcOffset++; + dstOffset+= dstChannels; } // x loop } // y loop } // pass loop @@ -262,9 +262,6 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels; for (uint32 x = 0; x < width; x++) { - srcOffset++; - dstOffset+= dstChannels; - uint32 index = curFrame->RasterBits[srcOffset]; if ((sint32)index != transparency) @@ -297,6 +294,9 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) _Data[0][dstOffset+1] = g; _Data[0][dstOffset+2] = b; _Data[0][dstOffset+3] = a; + + srcOffset++; + dstOffset+= dstChannels; } // x loop } // y loop }