mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-08 21:31:46 +08:00
engine: imagelib: fix pixel iteration bounds checking on 1-bit BMPs
move 1-bit BMP bounds checking to the beginning of a loop to prevent a second iteration Fixes: [GHSA-3p7j-2339-g5mm](https://github.com/FWGS/xash3d-fwgs/security/advisories/GHSA-3p7j-2339-g5mm) Signed-off-by: veygax <veyga@veygax.dev>
This commit is contained in:
@@ -219,13 +219,13 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
column--; // ingnore main iterations
|
||||
for( c = 0, k = 128; c < 8; c++, k >>= 1 )
|
||||
{
|
||||
if( ++column >= columns )
|
||||
break;
|
||||
red = green = blue = (!!(alpha & k) == 1 ? 0xFF : 0x00);
|
||||
*pixbuf++ = red;
|
||||
*pixbuf++ = green;
|
||||
*pixbuf++ = blue;
|
||||
*pixbuf++ = 0x00;
|
||||
if( ++column == columns )
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
||||
Reference in New Issue
Block a user