Skip to content

Commit 5faf172

Browse files
committed
Fix pointer alignment issue in OLE2 XLM macro extraction
Fix issue reading from a pointer which can cause a crash on systems that have strict pointer alignment requirements. Thank you to Hsuan-Ming Chen at Synology PSIRT for identify this issue and proposing this fix.
1 parent 69fc449 commit 5faf172

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libclamav/xlm_extract.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4044,7 +4044,9 @@ static cl_error_t parse_formula(FILE *out_file, char data[], unsigned data_size)
40444044
goto done;
40454045
}
40464046

4047-
double val = *(double *)&data[data_pos + 1];
4047+
double val;
4048+
/* Avoid unaligned double loads (may SIGBUS on 32-bit ARM). */
4049+
memcpy(&val, &data[data_pos + 1], sizeof(val));
40484050

40494051
len = fprintf(out_file, " %f", val);
40504052
if (len < 0) {

0 commit comments

Comments
 (0)