2025-11-22 12:40 UTC+0100 Aleksander Czajczynski (hb fki.pl)
* include/hbdefs.h
! fix undefined behaviour on signed int overflow in
HB_GET_LE_INT24(), HB_GET_BE_INT24() macros
reported by runtime sanitizer (LLVM -fsanitize-trap=undefined)
panic: left shift of 255 by 24 places cannot be represented
in type 'HB_I32' (aka 'int')
This commit is contained in:
@@ -7,6 +7,14 @@
|
|||||||
Entries may not always be in chronological/commit order.
|
Entries may not always be in chronological/commit order.
|
||||||
See license at the end of file. */
|
See license at the end of file. */
|
||||||
|
|
||||||
|
2025-11-22 12:40 UTC+0100 Aleksander Czajczynski (hb fki.pl)
|
||||||
|
* include/hbdefs.h
|
||||||
|
! fix undefined behaviour on signed int overflow in
|
||||||
|
HB_GET_LE_INT24(), HB_GET_BE_INT24() macros
|
||||||
|
reported by runtime sanitizer (LLVM -fsanitize-trap=undefined)
|
||||||
|
panic: left shift of 255 by 24 places cannot be represented
|
||||||
|
in type 'HB_I32' (aka 'int')
|
||||||
|
|
||||||
2025-11-17 14:14 UTC+0200 Aleksander Czajczynski (hb fki.pl)
|
2025-11-17 14:14 UTC+0200 Aleksander Czajczynski (hb fki.pl)
|
||||||
; sync macros in-line with Viktor's fork:
|
; sync macros in-line with Viktor's fork:
|
||||||
2015-06-16 01:41 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
|
2015-06-16 01:41 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
|
||||||
|
|||||||
@@ -1429,10 +1429,10 @@ typedef HB_U32 HB_FATTR;
|
|||||||
* so we always have to build them from HB_BYTEs and cannot use C casting
|
* so we always have to build them from HB_BYTEs and cannot use C casting
|
||||||
*/
|
*/
|
||||||
#define HB_GET_LE_INT24( p ) ( ( HB_I32 ) \
|
#define HB_GET_LE_INT24( p ) ( ( HB_I32 ) \
|
||||||
( ( ( HB_I32 ) (( const HB_BYTE * )( p ))[ 0 ] ) | \
|
( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 0 ] ) | \
|
||||||
( ( HB_I32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
||||||
( ( HB_I32 ) (( const HB_BYTE * )( p ))[ 2 ] << 16 ) | \
|
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 2 ] << 16 ) | \
|
||||||
( ( HB_I32 ) (((( const HB_BYTE * )( p ))[ 2 ] & 0x80 ) ? 0xFF : 0x00 ) << 24 ) ) )
|
( ( HB_U32 ) (((( const HB_BYTE * )( p ))[ 2 ] & 0x80 ) ? 0xFFu : 0x00u ) << 24 ) ) )
|
||||||
#define HB_GET_LE_UINT24( p ) ( ( HB_U32 ) \
|
#define HB_GET_LE_UINT24( p ) ( ( HB_U32 ) \
|
||||||
( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 0 ] ) | \
|
( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 0 ] ) | \
|
||||||
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
||||||
@@ -1443,10 +1443,10 @@ typedef HB_U32 HB_FATTR;
|
|||||||
(( HB_BYTE * )( p ))[ 2 ] = ( HB_BYTE )( ( u ) >> 16 ); \
|
(( HB_BYTE * )( p ))[ 2 ] = ( HB_BYTE )( ( u ) >> 16 ); \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
#define HB_GET_BE_INT24( p ) ( ( HB_I32 ) \
|
#define HB_GET_BE_INT24( p ) ( ( HB_I32 ) \
|
||||||
( ( ( HB_I32 ) (( const HB_BYTE * )( p ))[ 2 ] ) | \
|
( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 2 ] ) | \
|
||||||
( ( HB_I32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
||||||
( ( HB_I32 ) (( const HB_BYTE * )( p ))[ 0 ] << 16 ) | \
|
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 0 ] << 16 ) | \
|
||||||
( ( HB_I32 ) (((( const HB_BYTE * )( p ))[ 0 ] & 0x80 ) ? 0xFF : 0x00 ) << 24 ) ) )
|
( ( HB_U32 ) (((( const HB_BYTE * )( p ))[ 0 ] & 0x80 ) ? 0xFFu : 0x00u ) << 24 ) ) )
|
||||||
#define HB_GET_BE_UINT24( p ) ( ( HB_U32 ) \
|
#define HB_GET_BE_UINT24( p ) ( ( HB_U32 ) \
|
||||||
( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 2 ] ) | \
|
( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 2 ] ) | \
|
||||||
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
( ( HB_U32 ) (( const HB_BYTE * )( p ))[ 1 ] << 8 ) | \
|
||||||
|
|||||||
Reference in New Issue
Block a user