[Swfdec] 5 commits - README libswfdec/jpeg libswfdec/swfdec_image.c

David Schleef ds at kemper.freedesktop.org
Wed Mar 21 15:43:26 PDT 2007


 README                   |    2 +-
 libswfdec/jpeg/jpeg.c    |   13 +++++++++++++
 libswfdec/swfdec_image.c |   30 ++++++++++++++++++++++++++++--
 3 files changed, 42 insertions(+), 3 deletions(-)

New commits:
diff-tree bbf53a5c2060eadff2632674d2550a09719f41e1 (from parents)
Merge: 0f3d2abf794d0f1f69a38c4532c4e273054f4696 b12efb820117b62a7150d13359499678e7dcf31d
Author: Debian User <ds at gromit.(none)>
Date:   Wed Mar 21 15:43:19 2007 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/swfdec

diff-tree 0f3d2abf794d0f1f69a38c4532c4e273054f4696 (from 0bff3f8f4dcb94868a14d214e4c51ea6e7e644b2)
Author: Debian User <ds at gromit.(none)>
Date:   Wed Mar 21 15:42:59 2007 -0700

    Quick hack to block out some bad JPEG images.  Fixed JPEG decoder
    will come later.

diff --git a/libswfdec/jpeg/jpeg.c b/libswfdec/jpeg/jpeg.c
index 7c9086d..216d8a5 100644
--- a/libswfdec/jpeg/jpeg.c
+++ b/libswfdec/jpeg/jpeg.c
@@ -780,6 +780,19 @@ jpeg_decoder_addbits (JpegDecoder * dec,
 {
   unsigned int offset;
 
+#if 0
+  {
+    static int index = 0;
+    FILE *file;
+    char s[100];
+
+    sprintf(s, "image-%d.jpg", index++);
+    file = fopen(s, "w");
+    fwrite (data, len, 1, file);
+    fclose(file);
+  }
+#endif
+
   offset = dec->bits.ptr - dec->data;
 
   dec->data = realloc (dec->data, dec->data_len + len);
diff --git a/libswfdec/swfdec_image.c b/libswfdec/swfdec_image.c
index dc96fb6..79e353a 100644
--- a/libswfdec/swfdec_image.c
+++ b/libswfdec/swfdec_image.c
@@ -137,8 +137,22 @@ swfdec_image_jpeg_load (SwfdecImage *ima
 
   dec = jpeg_decoder_new ();
 
-  jpeg_decoder_addbits (dec, image->jpegtables->data,
-      image->jpegtables->length);
+  if (image->jpegtables) {
+    if (image->jpegtables->data[0] != 0xff || image->jpegtables->data[1] != 0xd8) {
+      SWFDEC_ERROR("not jpeg %02x %02x",
+          image->jpegtables->data[0], image->jpegtables->data[1]);
+      jpeg_decoder_free (dec);
+      return;
+    }
+    jpeg_decoder_addbits (dec, image->jpegtables->data,
+        image->jpegtables->length);
+  }
+  if (image->raw_data->data[2] != 0xff || image->raw_data->data[3] != 0xd8) {
+    SWFDEC_ERROR("not jpeg %02x %02x",
+        image->raw_data->data[2], image->raw_data->data[3]);
+    jpeg_decoder_free (dec);
+    return;
+  }
   jpeg_decoder_addbits (dec, image->raw_data->data + 2,
       image->raw_data->length - 2);
   jpeg_decoder_parse (dec);
@@ -185,6 +199,12 @@ swfdec_image_jpeg2_load (SwfdecImage *im
 
   dec = jpeg_decoder_new ();
 
+  if (image->raw_data->data[2] != 0xff || image->raw_data->data[3] != 0xd8) {
+    SWFDEC_ERROR("not jpeg %02x %02x",
+        image->raw_data->data[2], image->raw_data->data[3]);
+    jpeg_decoder_free (dec);
+    return;
+  }
   jpeg_decoder_addbits (dec, image->raw_data->data + 2,
       image->raw_data->length - 2);
   jpeg_decoder_parse (dec);
@@ -239,6 +259,12 @@ swfdec_image_jpeg3_load (SwfdecImage *im
 
   dec = jpeg_decoder_new ();
 
+  if (buffer->data[0] != 0xff || buffer->data[1] != 0xd8) {
+    SWFDEC_ERROR("not jpeg %02x %02x",
+        buffer->data[0], buffer->data[1]);
+    jpeg_decoder_free (dec);
+    return;
+  }
   jpeg_decoder_addbits (dec, buffer->data, buffer->length);
   swfdec_buffer_unref (buffer);
   jpeg_decoder_parse (dec);
diff-tree 0bff3f8f4dcb94868a14d214e4c51ea6e7e644b2 (from parents)
Merge: 075322c03bf08d5a7ce0bee51247e6b05f103341 72e2c95e9fbd6cdebc5755652ee3a8bb0b6af6b3
Author: Debian User <ds at gromit.(none)>
Date:   Mon Mar 19 13:44:58 2007 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/swfdec

diff-tree 075322c03bf08d5a7ce0bee51247e6b05f103341 (from parents)
Merge: bbc40a3f914b4698cbfcd4be29144cbae6959278 00252e7f75acd6466c2ae7c6fc446f4741dab7a1
Author: Debian User <ds at gromit.(none)>
Date:   Sat Mar 17 13:02:18 2007 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/swfdec

diff-tree bbc40a3f914b4698cbfcd4be29144cbae6959278 (from b86811135dd32ae460e5082f4f986664de624b89)
Author: Debian User <ds at gromit.(none)>
Date:   Sat Mar 17 13:01:05 2007 -0700

    Bump cairo requirement to 1.2

diff --git a/README b/README
index b4ee63b..261d04c 100644
--- a/README
+++ b/README
@@ -53,7 +53,7 @@ Limitations:
 
 Dependencies:
 
-  cairo (>= 1.0.0 - >= 1.4.0 recommended)
+  cairo (>= 1.2.0 - >= 1.4.0 recommended)
   liboil (>= 0.3.6)
   Pangocairo (aka Pango with cairo support)
   zlib (>= 1.1.4)


More information about the Swfdec mailing list