; * src/sfnt.c (sfnt_read_name_table): Avoid 32-bit overflow.

This commit is contained in:
Eli Zaretskii 2026-05-02 14:17:14 +03:00
parent 0d0891c1bb
commit d51a472231

View file

@ -5792,6 +5792,10 @@ sfnt_read_name_table (int fd, struct sfnt_offset_subtable *subtable)
if (directory->length < required)
return NULL;
/* Avoid overflow in xmalloc argument below. */
if (directory->length > UINT_MAX - sizeof *name)
return NULL;
/* Allocate enough to hold the name table and variable length
data. */
name = xmalloc (sizeof *name + directory->length);