1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00

Fix undefined behavior (left shift of negative number)

Fixes oss-fuzz #69441
This commit is contained in:
Dmitry Stogov
2024-06-05 11:15:36 +03:00
parent 8aff5b49c3
commit 9534e0d42d
+3 -3
View File
@@ -749,10 +749,10 @@ static signed short php_ifd_get16s(void *Short, int motorola_intel)
static int php_ifd_get32s(void *Long, int motorola_intel)
{
if (motorola_intel) {
return ((unsigned)((( char *)Long)[0]) << 24) | (((unsigned char *)Long)[1] << 16)
| ((( char *)Long)[2] << 8 ) | (((unsigned char *)Long)[3] << 0 );
return ((unsigned)(((unsigned char *)Long)[0]) << 24) | (((unsigned char *)Long)[1] << 16)
| (((unsigned char *)Long)[2] << 8 ) | (((unsigned char *)Long)[3] << 0 );
} else {
return ((unsigned)((( char *)Long)[3]) << 24) | (((unsigned char *)Long)[2] << 16)
return ((unsigned)(((unsigned char *)Long)[3]) << 24) | (((unsigned char *)Long)[2] << 16)
| (((unsigned char *)Long)[1] << 8 ) | (((unsigned char *)Long)[0] << 0 );
}
}