Explicitly cast to unsigned int before left-shifting

To avoid potential signed integer overflow (undefined behavior), as
implicit integer promotion means the operand becomes a (signed) int.
This commit is contained in:
Kleis Auke Wolthuizen 2020-07-19 14:37:38 +02:00
parent 3460814b98
commit aac1748615
1 changed files with 2 additions and 2 deletions

View File

@ -544,9 +544,9 @@ scanline_read_old( VipsSbuf *sbuf, COLR *scanline, int width )
if( scanline[0][RED] == 1 &&
scanline[0][GRN] == 1 &&
scanline[0][BLU] == 1 ) {
int i;
guint i;
for( i = scanline[0][EXP] << rshift;
for( i = ((guint32) scanline[0][EXP] << rshift);
i > 0 && width > 0; i-- ) {
copycolr( scanline[0], scanline[-1] );
scanline += 1;