summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2009-11-08 21:38:58 +1030
committerCarl Worth <cworth@cworth.org>2010-02-19 13:28:59 -0800
commit7169e1f694dd068b3eae0dce4696c0e8199842ff (patch)
tree6d43dfce9c76df4eb6ad91f689a99fba0265d25c /src
parent7f22d9d433599292d1e9778f29df02dbf6985f6f (diff)
Type1-subset: Check for binary eexec data
Type 1 fonts embedded in PDF have the the encrypted portion in binary but the existing check for binary only works for Type 1 fonts in PFB format. Add an additional check based on the first 4 characters of eexec data. The Type 1 specification gurantees that at least one of the first 4 bytes of ciphertext is not an ASCII Hex character. (cherry picked from commit ac59c7580894fc5fd424f7f6f8c1532d15048566)
Diffstat (limited to 'src')
-rw-r--r--src/cairo-type1-subset.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index a0616e3e..d8b04214 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -235,7 +235,7 @@ cairo_type1_font_subset_find_segments (cairo_type1_font_subset_t *font)
{
unsigned char *p;
const char *eexec_token;
- int size;
+ int size, i;
p = (unsigned char *) font->type1_data;
font->type1_end = font->type1_data + font->type1_length;
@@ -266,6 +266,10 @@ cairo_type1_font_subset_find_segments (cairo_type1_font_subset_t *font)
font->eexec_segment_size = font->type1_length - font->header_segment_size;
font->eexec_segment = (char *) p + font->header_segment_size;
font->eexec_segment_is_ascii = TRUE;
+ for (i = 0; i < 4; i++) {
+ if (!isxdigit(font->eexec_segment[i]))
+ font->eexec_segment_is_ascii = FALSE;
+ }
}
return CAIRO_STATUS_SUCCESS;