summaryrefslogtreecommitdiff
path: root/src/cairo-cff-subset.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2011-08-21 20:12:42 +0930
committerAdrian Johnson <ajohnson@redneon.com>2011-08-21 20:12:42 +0930
commitcdb00dec4231d2dd3c2f9c98c3533a716d71cf8c (patch)
tree21f7ba469b8275224aca775f3b5e85fe6ee6d9ca /src/cairo-cff-subset.c
parent23dfd92b29508623fce8570fc625a79df12bd883 (diff)
downloadcairo-cdb00dec4231d2dd3c2f9c98c3533a716d71cf8c.tar.gz
cff-subset: don't easily give up parsing a charstring if we already have the width
The 2 byte operators can be ignored of we don't need or have already found the width.
Diffstat (limited to 'src/cairo-cff-subset.c')
-rw-r--r--src/cairo-cff-subset.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index 6ded77ab5..71465bbb1 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -1436,9 +1436,13 @@ type2_decode_integer (unsigned char *p, int *integer)
* used.
*
* The width, if present, is the first integer in the charstring. The
- * only way to confirm if an integer at the start of the charstring is
+ * only way to confirm if the integer at the start of the charstring is
* the width is when the first stack clearing operator is parsed,
* check if there is an extra integer left over on the stack.
+ *
+ * When the first stack clearing operator is encountered
+ * type2_find_width is set to FALSE and type2_found_width is set to
+ * TRUE if an extra argument is found, otherwise FALSE.
*/
static cairo_status_t
cairo_cff_parse_charstring (cairo_cff_font_t *font,
@@ -1575,13 +1579,15 @@ cairo_cff_parse_charstring (cairo_cff_font_t *font,
} else if (*p == 12) {
/* 2 byte instruction */
- /* Most of the 2 byte operators */
- if (need_width && (p[1] < 0x22 || p[1] > 0x25))
+ /* All the 2 byte operators are either not valid before a
+ * stack clearing operator or they are one of the
+ * arithmetic, storage, or conditional operators. */
+ if (need_width && font->type2_find_width)
return CAIRO_INT_STATUS_UNSUPPORTED;
p += 2;
font->type2_stack_top_is_int = FALSE;
- } else {
+ } else {
/* 1 byte instruction */
p++;
font->type2_stack_top_is_int = FALSE;