diff options
author | Ben Wagner <bungeman@chromium.org> | 2023-03-01 12:19:17 -0500 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2023-03-02 20:56:41 +0100 |
commit | 09b326fa2b3198e462fc75f98973981f23ec7382 (patch) | |
tree | d513a665a36bf38fcbc4cc7589c978713b8c154b /include | |
parent | e95e623471282b5fe3de6f33263757b6f125f0bd (diff) | |
download | freetype2-09b326fa2b3198e462fc75f98973981f23ec7382.tar.gz |
Avoid strtol on non-null-terminated data.
Technically, `strtol` can only be used with C strings terminated with
`\0`. CID data is not generally null-terminated and often does not
contain a `\0` if it is hex-encoded. AddressSanitizer with `ASAN_OPTIONS`
containing `strict_string_checks=1` verifies this by using an adversarial
`strtol` that always reads to the terminating `\0`.
To avoid undefined behavior from `strtol` in `cid_parser_new`, use the
parser to parse the tokens instead of attempting to parse them ad-hoc.
This will internally use `PS_Conv_Strtol` to parse the integer, which
respects the parser's limits and directly implements the PostScript
parsing rules for integers.
* src/cid/cidparse.c (cid_parser_new): Use the parser to parse the
tokens.
Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1420329
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions