ubsan fixes

This commit is contained in:
laurent
2023-04-19 22:12:08 +02:00
committed by Robert Schmidt
parent 8a10d1b222
commit b735f8bec6
29 changed files with 301 additions and 235 deletions
+6 -3
View File
@@ -36,9 +36,12 @@
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint8_t) + sizeof(uint16_t)
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t)
#define ENCODE_U32(buffer, value, size) \
{ \
uint32_t tmp = htonl(value); \
memcpy(buffer, &tmp, sizeof(tmp)); \
} \
size += sizeof(uint32_t)
#define IES_ENCODE_U8(buffer, encoded, value) \
ENCODE_U8(buffer + encoded, value, encoded)