From 4827d6dd33f6d4185bee1d4c4289c66b9ccd0940 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Sun, 15 Jan 2023 14:45:47 -0500 Subject: [PATCH] SAS reader: Support 16MiB page sizes Fixes #286 --- src/readstat_malloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/readstat_malloc.c b/src/readstat_malloc.c index 9549e467..20168533 100644 --- a/src/readstat_malloc.c +++ b/src/readstat_malloc.c @@ -1,9 +1,11 @@ #include -#define MAX_MALLOC_SIZE 0xFFF000 -/* ~16 MB. Needs to be at least 0x3FF00, i.e. the default ~4MB block size used - * in compressed SPSS (ZSAV) files. The purpose here is to prevent massive - * allocations in the event of a malformed file or a bug in the library. */ +#define MAX_MALLOC_SIZE 0x1000000 +/* =16 MiB. Needs to be at least 0x3FF00, i.e. the default ~4MB block size used + * in compressed SPSS (ZSAV) files. Some SAS installations use 16MiB page sizes + * by default, see https://github.com/tidyverse/haven/issues/697. + * The purpose here is to prevent massive allocations in the event of a + * malformed file or a bug in the library. */ void *readstat_malloc(size_t len) { if (len > MAX_MALLOC_SIZE || len == 0) {