ソースを参照

fix(ci): Avoid asan complaining on misaligned memory

Stefan Profanter 5 年 前
コミット
30740b06db
共有1 個のファイルを変更した4 個の追加1 個の削除を含む
  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;
 }