diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2021-08-15 13:40:36 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2021-08-15 13:49:06 +0100 |
commit | d4468833b85b8c8f340bc9c3bb6572a245fd5982 (patch) | |
tree | 1447da848fa0e7bb10862a76247548e11d929289 | |
parent | 569a7dd761255ec0a04f9bc4e020440638395bb8 (diff) | |
download | librufl-d4468833b85b8c8f340bc9c3bb6572a245fd5982.tar.gz librufl-d4468833b85b8c8f340bc9c3bb6572a245fd5982.tar.bz2 |
Restrict total font faces to 16 bit range
The substitution tables expect there to be no more than 65535
font faces available. Enforce this at load, so there aren't any
unwanted surprises later.
-rw-r--r-- | src/rufl_init.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rufl_init.c b/src/rufl_init.c index 2fa81c3..4005203 100644 --- a/src/rufl_init.c +++ b/src/rufl_init.c @@ -267,7 +267,9 @@ rufl_code rufl_init_font_list(void) font_list_context context = 0; char identifier[80], local_name[80]; - while (context != -1) { + /* Permit up to 65535 font faces (we rely on 16bits of storage + * being sufficient in the substitution tables. */ + while (context != -1 && rufl_font_list_entries < UINT16_MAX) { /* read identifier */ rufl_fm_error = xfont_list_fonts((byte *)identifier, font_RETURN_FONT_NAME | |