Browse Source

fix(ci): Avoid asan complaining on misaligned memory

Stefan Profanter 5 years ago
parent
commit
30740b06db
1 changed files with 4 additions and 1 deletions
  1. 4 1
      tests/fuzz/custom_memory_manager.c

+ 4 - 1
tests/fuzz/custom_memory_manager.c

@@ -49,7 +49,10 @@ int UA_memoryManager_setLimitFromLast4Bytes(const uint8_t *data, size_t size) {
         return 0;
     // just cast the last 4 bytes to uint32
     const uint32_t *newLimit = (const uint32_t*)(uintptr_t)&(data[size-4]);
-    UA_memoryManager_setLimit(*newLimit);
+    uint32_t limit;
+    // use memcopy to avoid asan complaining on misaligned memory
+    memcpy(&limit, newLimit, sizeof(uint32_t));
+    UA_memoryManager_setLimit(limit);
     return 1;
 }