...
Some checks failed
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Has been cancelled
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Has been cancelled
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Has been cancelled
CI / Linux package (push) Has been cancelled
CI / Bundle test (macos-latest) (push) Has been cancelled
CI / Bundle test (ubuntu-latest) (push) Has been cancelled
CI / macOS Brew (push) Has been cancelled
CI / Test ./dev.sh and benchmark (push) Has been cancelled
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (c, macos-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Has been cancelled
Depscan / Scan dependencies for vulnerabilities (push) Has been cancelled

This commit is contained in:
Kovid Goyal 2026-09-19 15:57:26 +05:30
parent 2795eac486
commit 719c61a12b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -248,13 +248,25 @@ read_STAT_font_table(const uint8_t *table, size_t table_len, PyObject *name_look
const uint8_t *table_limit = table + table_len;
size_t count = 0;
if (_PyTuple_Resize(&design_axes, count_of_design_axis_entries) == -1) return false;
for (const uint8_t *pos = table + offset_to_start_of_design_axes_entries;
pos + size_of_design_axis_entry <= table_limit && count < count_of_design_axis_entries;
// Bound the loop by the actual size of the tuple being filled rather than
// by count_of_design_axis_entries, so that the index passed to
// PyTuple_SET_ITEM() below cannot run past the end of the tuple.
const size_t num_design_axes = (size_t)PyTuple_GET_SIZE(design_axes);
for (const uint8_t *pos = table + offset_to_start_of_design_axes_entries; pos + size_of_design_axis_entry <= table_limit && count < num_design_axes;
pos += size_of_design_axis_entry, count++) {
p = (uint16_t *)(pos + 4);
uint16_t name_id = next, ordering = next;
PyObject *rec = Py_BuildValue(
"{ss# sN sH sN}", "tag", (char *)pos, 4, "name", get_best_name(name_lookup_table, name_id), "ordering", ordering, "values", PyList_New(0));
"{ss# sN sH sN}",
"tag",
(char *)pos,
(Py_ssize_t)4,
"name",
get_best_name(name_lookup_table, name_id),
"ordering",
ordering,
"values",
PyList_New(0));
if (!rec) return false;
PyTuple_SET_ITEM(design_axes, count, rec);
}