[subset] fix data race touching Crap() in cff subsetting.

This commit is contained in:
Garret Rieger 2022-06-01 21:01:16 +00:00 committed by Behdad Esfahbod
parent d8d96b26e7
commit 98aaecd397
3 changed files with 5 additions and 3 deletions

View File

@ -1138,7 +1138,8 @@ struct cff1
cff1_top_dict_interp_env_t env (fontDictStr); cff1_top_dict_interp_env_t env (fontDictStr);
cff1_font_dict_interpreter_t font_interp (env); cff1_font_dict_interpreter_t font_interp (env);
font = fontDicts.push (); font = fontDicts.push ();
if (unlikely (font == &Crap (cff1_font_dict_values_t))) { fini (); return; } if (unlikely (fontDicts.in_error ())) { fini (); return; }
font->init (); font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; } if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
PRIVDICTVAL *priv = &privateDicts[i]; PRIVDICTVAL *priv = &privateDicts[i];

View File

@ -44,7 +44,8 @@ struct str_encoder_t
void encode_byte (unsigned char b) void encode_byte (unsigned char b)
{ {
if (unlikely (buff.push (b) == &Crap (unsigned char))) buff.push (b);
if (unlikely (buff.in_error ()))
set_error (); set_error ();
} }

View File

@ -159,7 +159,7 @@ int main(int argc, char** argv)
if (argc > 4) if (argc > 4)
{ {
num_tests = (argc - 3) / 2; num_tests = argc - 3;
tests = (test_input_t *) calloc (num_tests, sizeof (test_input_t)); tests = (test_input_t *) calloc (num_tests, sizeof (test_input_t));
for (unsigned i = 0; i < num_tests; i++) for (unsigned i = 0; i < num_tests; i++)
{ {