fixed bug in swf->pdf part of rendering pipeline
authorMatthias Kramm <kramm@quiss.org>
Tue, 25 Aug 2009 17:20:58 +0000 (19:20 +0200)
committerMatthias Kramm <kramm@quiss.org>
Tue, 25 Aug 2009 17:21:37 +0000 (19:21 +0200)
lib/devices/pdf.c
lib/modules/swfbits.c
lib/readers/swf.c

index 4d223c8..c1e1bb6 100644 (file)
@@ -205,9 +205,9 @@ void pdf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color
     char as_shape = 0;
     if(!type3) as_shape=1;
     if(glyphnr>256-32) as_shape=1;
-    gfxmatrix_dump(matrix, stdout, "");
     if(fabs(matrix->m00 + matrix->m11) > 0.01) as_shape=1;
     if(fabs(fabs(matrix->m01) + fabs(matrix->m10)) > 0.01) as_shape=1;
+    if(fabs(matrix->m00) < 0.01) as_shape=1;
 
     if(as_shape) {
        gfxline_t*line2 = gfxline_clone(glyph->line);
index 88ba8b9..4fa38f5 100644 (file)
@@ -561,7 +561,8 @@ static void tag_init_source(struct jpeg_decompress_struct *cinfo)
 static boolean tag_fill_input_buffer(struct jpeg_decompress_struct *cinfo)
 {
     TAG *tag = (TAG *) cinfo->client_data;
-    if (tag->data[tag->pos + 0] == 0xff &&
+    if (tag->pos + 4 <= tag->len &&
+       tag->data[tag->pos + 0] == 0xff &&
        tag->data[tag->pos + 1] == 0xd9 &&
        tag->data[tag->pos + 2] == 0xff &&
        tag->data[tag->pos + 3] == 0xd8) {
index da6d6ae..132bf84 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <assert.h>
 #include "../gfxdevice.h"
 #include "../gfxsource.h"
@@ -698,12 +699,20 @@ gfxdocument_t*swf_open(gfxsource_t*src, const char*filename)
     return swf_doc;
 }
 
+static void swf_destroy(gfxsource_t*src)
+{
+    memset(src, 0, sizeof(*src));
+    free(src);
+}
+
+
 gfxsource_t*gfxsource_swf_create()
 {
     gfxsource_t*src = (gfxsource_t*)malloc(sizeof(gfxsource_t));
     memset(src, 0, sizeof(gfxsource_t));
     src->set_parameter = swf_set_parameter;
     src->open = swf_open;
+    src->destroy = swf_destroy;
     return src;
 }