[core,orders] shift unsigned value

The delta value read is signed, but the operations are done on an
unsigned.
This commit is contained in:
akallabeth
2024-04-22 09:57:37 +02:00
committed by akallabeth
parent cb15c1c78a
commit 5b4e39fd7e

View File

@@ -797,9 +797,11 @@ static INLINE BOOL update_write_4byte_unsigned(wStream* s, UINT32 value)
return TRUE;
}
static INLINE BOOL update_read_delta(wStream* s, INT32* value)
{
BYTE byte = 0;
UINT32 uvalue = 0;
if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
return FALSE;
@@ -807,9 +809,9 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
Stream_Read_UINT8(s, byte);
if (byte & 0x40)
*value = (byte | ~0x3F);
uvalue = (byte | ~0x3F);
else
*value = (byte & 0x3F);
uvalue = (byte & 0x3F);
if (byte & 0x80)
{
@@ -817,8 +819,9 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
return FALSE;
Stream_Read_UINT8(s, byte);
*value = (*value << 8) | byte;
uvalue = (uvalue << 8) | byte;
}
*value = (INT32)uvalue;
return TRUE;
}