summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-jpeg.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-12-09 18:55:12 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-12-09 18:55:12 +0000
commit2943543c1b68545c712c6f0e8055c01cccc2fda7 (patch)
tree0724c464a1015d768b9ac37c17803047fd91c007 /gdk-pixbuf/io-jpeg.c
parent6f19a46cf90ebe2d85fd68e74e4a405d4639c07e (diff)
downloadgdk-pixbuf-2943543c1b68545c712c6f0e8055c01cccc2fda7.tar.gz
Fix the spinguard logic for big buffers. (#494667, Ed Catmur)
2007-12-09 Matthias Clasen <mclasen@redhat.com> * io-jpeg.c: Fix the spinguard logic for big buffers. (#494667, Ed Catmur) svn path=/trunk/; revision=19135
Diffstat (limited to 'gdk-pixbuf/io-jpeg.c')
-rw-r--r--gdk-pixbuf/io-jpeg.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index fdcc3e2cb..7df7e1cd5 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -812,7 +812,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
struct jpeg_decompress_struct *cinfo;
my_src_ptr src;
guint num_left, num_copy;
- guint last_bytes_left;
+ guint last_num_left, last_bytes_left;
guint spinguard;
gboolean first;
const guchar *bufhd;
@@ -853,6 +853,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
if (num_left == 0)
return TRUE;
+ last_num_left = num_left;
last_bytes_left = 0;
spinguard = 0;
first = TRUE;
@@ -880,10 +881,13 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
if (first) {
last_bytes_left = src->pub.bytes_in_buffer;
first = FALSE;
- } else if (src->pub.bytes_in_buffer == last_bytes_left)
+ } else if (src->pub.bytes_in_buffer == last_bytes_left
+ && num_left == last_num_left) {
spinguard++;
- else
+ } else {
last_bytes_left = src->pub.bytes_in_buffer;
+ last_num_left = num_left;
+ }
/* should not go through twice and not pull bytes out of buf */
if (spinguard > 2)