[cairo-commit] src/cairo-type1-subset.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Tue Oct 30 01:54:37 PDT 2012


 src/cairo-type1-subset.c |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 0c800dc3f64ee030df1cd0a6a1dcd6df71502dea
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Oct 30 19:23:30 2012 +1030

    type1-subset: ensure subroutine numnber is an integer

diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 786055a..dff4a95 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -827,15 +827,18 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
 
 	    case TYPE1_CHARSTRING_COMMAND_CALLSUBR:
 		if (font->subset_subrs && font->build_stack.sp > 0) {
-		    int subr_num = font->build_stack.stack[--font->build_stack.sp];
-		    if (subr_num >= 0 && subr_num < font->num_subrs) {
-			font->subrs[subr_num].used = TRUE;
-			status = cairo_type1_font_subset_parse_charstring (
-			                                   font,
-							   glyph,
-							   font->subrs[subr_num].subr_string,
-							   font->subrs[subr_num].subr_length);
-			break;
+		    double int_val;
+		    if (modf(font->build_stack.stack[--font->build_stack.sp], &int_val) == 0.0) {
+			int subr_num = int_val;
+			if (subr_num >= 0 && subr_num < font->num_subrs) {
+			    font->subrs[subr_num].used = TRUE;
+			    status = cairo_type1_font_subset_parse_charstring (
+				font,
+				glyph,
+				font->subrs[subr_num].subr_string,
+				font->subrs[subr_num].subr_length);
+			    break;
+			}
 		    }
 		}
 		font->subset_subrs = FALSE;


More information about the cairo-commit mailing list