mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2026-04-05 21:51:03 +00:00
refactor: use AARU_ALIGN16 macro for 16-byte alignment in crc64_clmul.c and crc64_vmull.c
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#define AARU_ALIGN16 __declspec(align(16))
|
||||
#else
|
||||
#define AARU_ALIGN16 __attribute__((aligned(16)))
|
||||
#endif
|
||||
|
||||
#include <aaruformat.h>
|
||||
@@ -196,7 +199,7 @@ AARU_EXPORT CLMUL uint64_t AARU_CALL aaruf_crc64_clmul(const uint64_t crc, const
|
||||
|
||||
// For the second block, safely handle the case where it extends past the actual data
|
||||
// Always use safe copy approach to avoid ASan buffer overflow detection
|
||||
uint8_t temp[16] __attribute__((aligned(16))) = {0};
|
||||
AARU_ALIGN16 uint8_t temp[16] = {0};
|
||||
const uint8_t *next_block_addr = (const uint8_t *)(aligned_data + 1);
|
||||
|
||||
// Only copy bytes that are actually within the original buffer
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define AARU_ALIGN16 __declspec(align(16))
|
||||
#else
|
||||
#define AARU_ALIGN16 __attribute__((aligned(16)))
|
||||
#endif
|
||||
|
||||
#include <aaruformat.h>
|
||||
|
||||
#include "arm_vmull.h"
|
||||
@@ -170,7 +176,7 @@ AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL aaruf_crc64_vmull(uint64_t previ
|
||||
|
||||
// For the second block, always use safe copy to avoid buffer overflow
|
||||
// The algorithm expects to read up to alignedEnd, but ASan prevents over-reading
|
||||
uint8_t temp[16] __attribute__((aligned(16))) = {0};
|
||||
AARU_ALIGN16 uint8_t temp[16] = {0};
|
||||
const uint8_t *nextBlockAddr = (const uint8_t *)(alignedData + 1);
|
||||
|
||||
// Only copy bytes that are actually within the original buffer
|
||||
|
||||
Reference in New Issue
Block a user