1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

* src/json.c (make_symset_table): Fix over-large allocation size.

We multiplied when we should have added.  Oops.
This commit is contained in:
Mattias Engdegård 2024-04-04 12:21:26 +02:00
parent 57e78f2d49
commit a0d646fb9f

View File

@ -143,7 +143,7 @@ make_symset_table (int bits, struct symset_tbl *up)
int maxbits = min (SIZE_WIDTH - 2 - (word_size < 8 ? 2 : 3), 32);
if (bits > maxbits)
memory_full (PTRDIFF_MAX); /* Will never happen in practice. */
struct symset_tbl *st = xnmalloc (sizeof *st->entries << bits, sizeof *st);
struct symset_tbl *st = xmalloc (sizeof *st + (sizeof *st->entries << bits));
st->up = up;
ptrdiff_t size = symset_size (bits);
for (ptrdiff_t i = 0; i < size; i++)