diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-20 08:32:41 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-23 19:18:52 -0700 |
| commit | 9851c5ea3410589dadfc43e809fd65ee66b58d28 (patch) | |
| tree | ac60766f28480d765c3593a523a2f62acae2c847 /src | |
| parent | 59b2f8f1dc4513df32e81a7a0d38d5b09c0d6049 (diff) | |
Shrink STRING_BYTES_MAX slightly
* src/alloc.c (STRING_BYTES_MAX): Also don’t allow sizes to exceed
PTRDIFF_MAX in internal calculations when calling malloc, as those
are problematic even if the final number of bytes does not exceed
PTRDIFF_MAX.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c index a73e7df1dc7..387b196bbee 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1501,7 +1501,7 @@ sdata_size (ptrdiff_t n) calculating a value to be passed to malloc. */ static ptrdiff_t const STRING_BYTES_MAX = min (STRING_BYTES_BOUND, - ((SIZE_MAX + ((min (PTRDIFF_MAX, SIZE_MAX) - GC_STRING_EXTRA - offsetof (struct sblock, data) - SDATA_DATA_OFFSET) |
