ref: 156b30b1aadb958f795e9888f5dfd115aae0fcec
parent: 753e1131eeadcfec4bf2c24fdaf67bf9d3005b6e
author: Werner Lemberg <[email protected]>
date: Mon Feb 20 04:06:22 EST 2017
[cff] Sanitize `initialRandomSeed'. * src/cff/cffload.c (cff_load_private_dict): Make `initial_random_seed' value always positive.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2017-02-20 Werner Lemberg <[email protected]>
+ [cff] Sanitize `initialRandomSeed'.
+
+ * src/cff/cffload.c (cff_load_private_dict): Make
+ `initial_random_seed' value always positive.
+
+2017-02-20 Werner Lemberg <[email protected]>
+
[cff] Introduce `random-seed' property (2/2).
* src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'.
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1913,6 +1913,13 @@
/* ensure that `num_blue_values' is even */
priv->num_blue_values &= ~1;
+ /* sanitize `initialRandomSeed' to be a positive value, if necessary; */
+ /* this is not mandated by the specification but by our implementation */
+ if ( priv->initial_random_seed < 0 )
+ priv->initial_random_seed = -priv->initial_random_seed;
+ else if ( priv->initial_random_seed == 0 )
+ priv->initial_random_seed = 987654321;
+
Exit:
/* clean up */
cff_blend_clear( subfont ); /* clear blend stack */