diff --git a/.gdk-pixbuf2.metadata b/.gdk-pixbuf2.metadata
index 9e5bd9f..02f2670 100644
--- a/.gdk-pixbuf2.metadata
+++ b/.gdk-pixbuf2.metadata
@@ -1 +1 @@
-9876d0a20f592f8fb2a52d4a86ec43d607661beb SOURCES/gdk-pixbuf-2.28.2.tar.xz
+99de0f54ac0db273599a8a5fb6def7c4e326c2cf SOURCES/gdk-pixbuf-2.31.6.tar.xz
diff --git a/.gitignore b/.gitignore
index e0c6638..f9fa4d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/gdk-pixbuf-2.28.2.tar.xz
+SOURCES/gdk-pixbuf-2.31.6.tar.xz
diff --git a/SOURCES/0001-Make-update-cache-work-better.patch b/SOURCES/0001-Make-update-cache-work-better.patch
deleted file mode 100644
index 6c75e15..0000000
--- a/SOURCES/0001-Make-update-cache-work-better.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From bfb6aa74d52c369d3bc136d8d5e869ec61a748b6 Mon Sep 17 00:00:00 2001
-From: Matthias Clasen <mclasen@redhat.com>
-Date: Wed, 13 Nov 2013 17:32:59 -0500
-Subject: [PATCH] Make --update-cache work better
-
-Due to an oversight, combining the --update-cache option with
-explicitly specified modules was leading to an attempt to
-open the --update-cache.so module - with predictably disappointing
-results. Make this work as intended, and as described
-in the man page.
----
- gdk-pixbuf/queryloaders.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
-index f1b22ce..d23654e 100644
---- a/gdk-pixbuf/queryloaders.c
-+++ b/gdk-pixbuf/queryloaders.c
-@@ -374,7 +374,7 @@ int main (int argc, char **argv)
-         else {
-                 char *cwd = g_get_current_dir ();
- 
--                for (i = 1; i < argc; i++) {
-+                for (i = first_file; i < argc; i++) {
-                         char *infilename = argv[i];
- #ifdef G_OS_WIN32
-                         infilename = g_locale_to_utf8 (infilename,
--- 
-1.8.4.2
-
diff --git a/SOURCES/0001-Skip-tests-when-we-can-t-run-them-due-to-lack-of-mem.patch b/SOURCES/0001-Skip-tests-when-we-can-t-run-them-due-to-lack-of-mem.patch
new file mode 100644
index 0000000..2843147
--- /dev/null
+++ b/SOURCES/0001-Skip-tests-when-we-can-t-run-them-due-to-lack-of-mem.patch
@@ -0,0 +1,128 @@
+From e7f940102d40997f2e23a0589247cfb189dfaa98 Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain@orangesquash.org.uk>
+Date: Sun, 20 Sep 2015 13:24:21 +0100
+Subject: [PATCH] Skip tests when we can't run them due to lack of memory
+
+Check if we have failed due to insufficient memory and skip if
+so.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=754387
+---
+ tests/Makefile.am     |  2 ++
+ tests/cve-2015-4491.c |  4 ++++
+ tests/pixbuf-scale.c  | 25 ++++++++++++++++++++++---
+ tests/test-common.c   | 14 ++++++++++++++
+ tests/test-common.h   |  1 +
+ 5 files changed, 43 insertions(+), 3 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index d5dca44..1f09711 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -65,6 +65,8 @@ dist_installed_test_data =		\
+ 
+ cve_2015_4491_SOURCES =			\
+ 	cve-2015-4491.c			\
++	test-common.c			\
++	test-common.h			\
+ 	resources.h			\
+ 	resources.c			\
+ 	$(NULL)
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index d5dca44..1f09711 100644
+--- a/tests/Makefile.in
++++ b/tests/Makefile.in
+@@ -202,7 +202,7 @@
+ am__v_lt_1 = 
+ am__objects_1 =
+ am_cve_2015_4491_OBJECTS = cve-2015-4491.$(OBJEXT) resources.$(OBJEXT) \
+-	$(am__objects_1)
++	test-common.$(OBJEXT) $(am__objects_1)
+ cve_2015_4491_OBJECTS = $(am_cve_2015_4491_OBJECTS)
+ cve_2015_4491_LDADD = $(LDADD)
+ cve_2015_4491_DEPENDENCIES = $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la \
+@@ -879,6 +879,8 @@
+ 
+ cve_2015_4491_SOURCES = \
+ 	cve-2015-4491.c			\
++	test-common.c			\
++	test-common.h			\
+ 	resources.h			\
+ 	resources.c			\
+ 	$(NULL)
+diff --git a/tests/cve-2015-4491.c b/tests/cve-2015-4491.c
+index 34ba94f..988cb49 100644
+--- a/tests/cve-2015-4491.c
++++ b/tests/cve-2015-4491.c
+@@ -20,6 +20,8 @@
+ 
+ #include <gdk-pixbuf.h>
+ 
++#include "test-common.h"
++
+ static void
+ test_original (void)
+ {
+@@ -28,6 +30,8 @@ test_original (void)
+   GError* err = NULL;
+ 
+   buf = gdk_pixbuf_new_from_resource_at_scale ("/test/resource/cve-2015-4491.bmp", size, size, FALSE, &err);
++  if (skip_if_insufficient_memory (&err))
++    return;
+ 
+   g_assert_no_error (err);
+ 
+diff --git a/tests/pixbuf-scale.c b/tests/pixbuf-scale.c
+index e2be5f5..60d0a20 100644
+--- a/tests/pixbuf-scale.c
++++ b/tests/pixbuf-scale.c
+@@ -83,6 +83,9 @@ test_scale_down (gconstpointer data)
+ 
+   path = g_test_get_filename (G_TEST_DIST, filename, NULL);
+   ref = gdk_pixbuf_new_from_file (path, &error);
++
++  if (skip_if_insufficient_memory (&error))
++    return;
+   g_assert_no_error (error);
+ 
+   width = gdk_pixbuf_get_width (ref);
+diff --git a/tests/test-common.c b/tests/test-common.c
+index 7071d4c..0f70a8b 100644
+--- a/tests/test-common.c
++++ b/tests/test-common.c
+@@ -65,6 +65,20 @@ format_supported (const gchar *filename)
+ }
+ 
+ gboolean
++skip_if_insufficient_memory (GError **err)
++{
++  if (*err && g_error_matches (*err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY))
++  {
++      g_test_skip ((*err)->message);
++      g_error_free (*err);
++      *err = NULL;
++      return TRUE;
++  }
++
++  return FALSE;
++}
++
++gboolean
+ pixdata_equal (GdkPixbuf *p1, GdkPixbuf *p2, GError **error)
+ {
+   if (gdk_pixbuf_get_colorspace (p1) != gdk_pixbuf_get_colorspace (p2)) {
+diff --git a/tests/test-common.h b/tests/test-common.h
+index 56e4418..0514cd7 100644
+--- a/tests/test-common.h
++++ b/tests/test-common.h
+@@ -28,6 +28,7 @@
+ G_BEGIN_DECLS
+ 
+ gboolean format_supported (const gchar *filename);
++gboolean skip_if_insufficient_memory (GError **err);
+ gboolean pixdata_equal (GdkPixbuf *p1, GdkPixbuf *p2, GError **error);
+ 
+ G_END_DECLS
+-- 
+2.4.3
+
diff --git a/SOURCES/0001-pixops-Chane-variable-type.patch b/SOURCES/0001-pixops-Chane-variable-type.patch
new file mode 100644
index 0000000..f73e0b3
--- /dev/null
+++ b/SOURCES/0001-pixops-Chane-variable-type.patch
@@ -0,0 +1,37 @@
+From 3df91dc6c6f8d1421e9c8756959280de792af77a Mon Sep 17 00:00:00 2001
+From: Benjamin Otte <otte@redhat.com>
+Date: Sat, 22 Aug 2015 17:57:23 +0200
+Subject: [PATCH 1/2] pixops: Chane variable type
+
+n_weights is used to do overflow checks. So by reducing the size to 32
+bits signed we overflow earlier. This is necessary because further down
+the code lots of code uses int variables to iterate over this variable
+and we don't want those to overflow.
+
+The correct fix would be to make all those variables gsize too, but
+that's way more invasive and requires different checks in different
+places so I'm not gonna do that now.
+And as long as scale factors are not expected to reach G_MAXINT it's not
+really necessary to do this change anyway.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=753908
+---
+ gdk-pixbuf/pixops/pixops.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
+index 7f2cbff..b7951c7 100644
+--- a/gdk-pixbuf/pixops/pixops.c
++++ b/gdk-pixbuf/pixops/pixops.c
+@@ -1272,7 +1272,7 @@ make_filter_table (PixopsFilter *filter)
+   int i_offset, j_offset;
+   int n_x = filter->x.n;
+   int n_y = filter->y.n;
+-  gsize n_weights;
++  int n_weights;
+   int *weights;
+ 
+   n_weights = SUBSAMPLE * SUBSAMPLE * n_x;
+-- 
+2.5.2
+
diff --git a/SOURCES/0001-pixops-Fail-make_weights-functions-on-OOM.patch b/SOURCES/0001-pixops-Fail-make_weights-functions-on-OOM.patch
new file mode 100644
index 0000000..dc187b9
--- /dev/null
+++ b/SOURCES/0001-pixops-Fail-make_weights-functions-on-OOM.patch
@@ -0,0 +1,195 @@
+From 19f9685dbff7d1f929c61cf99188df917a18811d Mon Sep 17 00:00:00 2001
+From: Benjamin Otte <otte@redhat.com>
+Date: Sat, 19 Sep 2015 21:24:34 +0200
+Subject: [PATCH] pixops: Fail make_weights functions on OOM
+
+The weights could grow very large under certain circumstances, in
+particular in security-relevant conditions, including the testsuite.
+By allowing the weight allocation to fail, this can be worked around.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=754387
+---
+ gdk-pixbuf/pixops/pixops.c | 75 +++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 55 insertions(+), 20 deletions(-)
+
+diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
+index e41b286..4cdb5df 100644
+--- a/gdk-pixbuf/pixops/pixops.c
++++ b/gdk-pixbuf/pixops/pixops.c
+@@ -1478,15 +1478,19 @@ pixops_process (guchar         *dest_buf,
+ /* Compute weights for reconstruction by replication followed by
+  * sampling with a box filter
+  */
+-static void
++static gboolean
+ tile_make_weights (PixopsFilterDimension *dim,
+ 		   double                 scale)
+ {
+   int n = ceil (1 / scale + 1);
+-  double *pixel_weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
++  double *pixel_weights;
+   int offset;
+   int i;
+ 
++  pixel_weights = g_try_malloc_n (sizeof (double) * SUBSAMPLE, n);
++  if (pixel_weights == NULL)
++    return FALSE;
++
+   dim->n = n;
+   dim->offset = 0;
+   dim->weights = pixel_weights;
+@@ -1514,13 +1518,15 @@ tile_make_weights (PixopsFilterDimension *dim,
+             }
+        }
+     }
++
++  return TRUE;
+ }
+ 
+ /* Compute weights for a filter that, for minification
+  * is the same as 'tiles', and for magnification, is bilinear
+  * reconstruction followed by a sampling with a delta function.
+  */
+-static void
++static gboolean
+ bilinear_magnify_make_weights (PixopsFilterDimension *dim,
+ 			       double                 scale)
+ {
+@@ -1541,7 +1547,9 @@ bilinear_magnify_make_weights (PixopsFilterDimension *dim,
+     }
+ 
+   dim->n = n;
+-  dim->weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
++  dim->weights = g_try_malloc_n (sizeof (double) * SUBSAMPLE, n);
++  if (dim->weights == NULL)
++    return FALSE;
+ 
+   pixel_weights = dim->weights;
+ 
+@@ -1581,6 +1589,8 @@ bilinear_magnify_make_weights (PixopsFilterDimension *dim,
+             }
+         }
+     }
++
++  return TRUE;
+ }
+ 
+ /* Computes the integral from b0 to b1 of
+@@ -1627,15 +1637,19 @@ linear_box_half (double b0, double b1)
+ /* Compute weights for reconstructing with bilinear
+  * interpolation, then sampling with a box filter
+  */
+-static void
++static gboolean
+ bilinear_box_make_weights (PixopsFilterDimension *dim,
+ 			   double                 scale)
+ {
+   int n = ceil (1/scale + 3.0);
+-  double *pixel_weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
++  double *pixel_weights;
+   double w;
+   int offset, i;
+ 
++  pixel_weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
++  if (pixel_weights == NULL)
++    return FALSE;
++
+   dim->offset = -1.0;
+   dim->n = n;
+   dim->weights = pixel_weights;
+@@ -1653,9 +1667,11 @@ bilinear_box_make_weights (PixopsFilterDimension *dim,
+           *(pixel_weights++) = w * scale;
+         }
+     }
++
++  return TRUE;
+ }
+ 
+-static void
++static gboolean
+ make_weights (PixopsFilter     *filter,
+ 	      PixopsInterpType  interp_type,	      
+ 	      double            scale_x,
+@@ -1664,23 +1680,39 @@ make_weights (PixopsFilter     *filter,
+   switch (interp_type)
+     {
+     case PIXOPS_INTERP_NEAREST:
++    default:
+       g_assert_not_reached ();
+-      break;
++      return FALSE;
+ 
+     case PIXOPS_INTERP_TILES:
+-      tile_make_weights (&filter->x, scale_x);
+-      tile_make_weights (&filter->y, scale_y);
+-      break;
++      if (!tile_make_weights (&filter->x, scale_x))
++        return FALSE;
++      if (!tile_make_weights (&filter->y, scale_y))
++        {
++          g_free (filter->x.weights);
++          return FALSE;
++        }
++      return TRUE;
+       
+     case PIXOPS_INTERP_BILINEAR:
+-      bilinear_magnify_make_weights (&filter->x, scale_x);
+-      bilinear_magnify_make_weights (&filter->y, scale_y);
+-      break;
++      if (!bilinear_magnify_make_weights (&filter->x, scale_x))
++        return FALSE;
++      if (!bilinear_magnify_make_weights (&filter->y, scale_y))
++        {
++          g_free (filter->x.weights);
++          return FALSE;
++        }
++      return TRUE;
+       
+     case PIXOPS_INTERP_HYPER:
+-      bilinear_box_make_weights (&filter->x, scale_x);
+-      bilinear_box_make_weights (&filter->y, scale_y);
+-      break;
++      if (!bilinear_box_make_weights (&filter->x, scale_x))
++        return FALSE;
++      if (!bilinear_box_make_weights (&filter->y, scale_y))
++        {
++          g_free (filter->x.weights);
++          return FALSE;
++        }
++      return TRUE;
+     }
+ }
+ 
+@@ -1735,7 +1767,8 @@ _pixops_composite_color_real (guchar          *dest_buf,
+     }
+   
+   filter.overall_alpha = overall_alpha / 255.;
+-  make_weights (&filter, interp_type, scale_x, scale_y);
++  if (!make_weights (&filter, interp_type, scale_x, scale_y))
++    return;
+ 
+ #ifdef USE_MMX
+   if (filter.x.n == 2 && filter.y.n == 2 &&
+@@ -1890,7 +1923,8 @@ _pixops_composite_real (guchar          *dest_buf,
+     }
+   
+   filter.overall_alpha = overall_alpha / 255.;
+-  make_weights (&filter, interp_type, scale_x, scale_y);
++  if (!make_weights (&filter, interp_type, scale_x, scale_y))
++    return;
+ 
+   if (filter.x.n == 2 && filter.y.n == 2 && dest_channels == 4 &&
+       src_channels == 4 && src_has_alpha && !dest_has_alpha)
+@@ -2297,7 +2331,8 @@ _pixops_scale_real (guchar        *dest_buf,
+     }
+   
+   filter.overall_alpha = 1.0;
+-  make_weights (&filter, interp_type, scale_x, scale_y);
++  if (!make_weights (&filter, interp_type, scale_x, scale_y))
++    return;
+ 
+   if (filter.x.n == 2 && filter.y.n == 2 && dest_channels == 3 && src_channels == 3)
+     {
+-- 
+2.5.2
+
diff --git a/SOURCES/0002-pixops-Be-smarter-than-gcc-s-optimizer.patch b/SOURCES/0002-pixops-Be-smarter-than-gcc-s-optimizer.patch
new file mode 100644
index 0000000..b372d27
--- /dev/null
+++ b/SOURCES/0002-pixops-Be-smarter-than-gcc-s-optimizer.patch
@@ -0,0 +1,46 @@
+From dd4b061c27dc0865c8f8987d294de6e04b321c18 Mon Sep 17 00:00:00 2001
+From: Benjamin Otte <otte@redhat.com>
+Date: Sat, 22 Aug 2015 23:06:23 +0200
+Subject: [PATCH 2/2] pixops: Be smarter than gcc's optimizer
+
+gcc realizes that the overflow checks aren't necessary. Why not?
+
+Well, if an int overflows, the behavior is undefined. And turning on
+-fomit-instructions is valid behavior in an undefined situation.
+---
+ gdk-pixbuf/pixops/pixops.c | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
+index b7951c7..5564a40 100644
+--- a/gdk-pixbuf/pixops/pixops.c
++++ b/gdk-pixbuf/pixops/pixops.c
+@@ -1272,18 +1272,17 @@ make_filter_table (PixopsFilter *filter)
+   int i_offset, j_offset;
+   int n_x = filter->x.n;
+   int n_y = filter->y.n;
+-  int n_weights;
+   int *weights;
+ 
+-  n_weights = SUBSAMPLE * SUBSAMPLE * n_x;
+-  if (n_weights / (SUBSAMPLE * SUBSAMPLE) != n_x)
+-    return NULL; /* overflow, bail */
++  /* check n_x doesn't overflow */
++  if (G_MAXINT / (SUBSAMPLE * SUBSAMPLE) < n_x)
++    return NULL;
+ 
+-  n_weights *= n_y;
+-  if (n_weights / (SUBSAMPLE * SUBSAMPLE * n_x) != n_y)
+-    return NULL; /* overflow, bail */
++  /* check n_y doesn't overflow */
++  if (G_MAXINT / (SUBSAMPLE * SUBSAMPLE * n_x) < n_y)
++    return NULL;
+ 
+-  weights = g_try_new (int, n_weights);
++  weights = g_try_new (int, SUBSAMPLE * SUBSAMPLE * n_x * n_y);
+   if (!weights)
+     return NULL; /* overflow, bail */
+ 
+-- 
+2.5.2
+
diff --git a/SOURCES/cve-2015-4491.patch b/SOURCES/cve-2015-4491.patch
deleted file mode 100644
index 14695d9..0000000
--- a/SOURCES/cve-2015-4491.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-commit ffec86ed5010c5a2be14f47b33bcf4ed3169a199
-Author: Matthias Clasen <mclasen@redhat.com>
-Date:   Mon Jul 13 00:33:40 2015 -0400
-
-    pixops: Be more careful about integer overflow
-    
-    Our loader code is supposed to handle out-of-memory and overflow
-    situations gracefully, reporting errors instead of aborting. But
-    if you load an image at a specific size, we also execute our
-    scaling code, which was not careful enough about overflow in some
-    places.
-    
-    This commit makes the scaling code silently return if it fails to
-    allocate filter tables. This is the best we can do, since
-    gdk_pixbuf_scale() is not taking a GError.
-    
-    https://bugzilla.gnome.org/show_bug.cgi?id=752297
-
-commit 8dba67cb4f38d62a47757741ad41e3f245b4a32a
-Author: Benjamin Otte <otte@redhat.com>
-Date:   Mon Aug 17 18:52:47 2015 +0200
-
-    pixops: Fix oversight for CVE-2015-4491
-    
-    The n_x variable could be made large enough to overflow, too.
-    
-    Also included are various testcases for this vulnerability:
-    - The original exploit (adapted for the testsuite)
-    - Causing overflow by making both X and Y variables large
-    - Causing overflow using only the X variable
-    - Causing overflow using only the Y variable
-    
-    https://bugzilla.gnome.org/show_bug.cgi?id=752297
-
-diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
-index 29a1c14..7f2cbff 100644
---- a/gdk-pixbuf/pixops/pixops.c
-+++ b/gdk-pixbuf/pixops/pixops.c
-@@ -1272,7 +1272,20 @@ make_filter_table (PixopsFilter *filter)
-   int i_offset, j_offset;
-   int n_x = filter->x.n;
-   int n_y = filter->y.n;
--  int *weights = g_new (int, SUBSAMPLE * SUBSAMPLE * n_x * n_y);
-+  gsize n_weights;
-+  int *weights;
-+
-+  n_weights = SUBSAMPLE * SUBSAMPLE * n_x;
-+  if (n_weights / (SUBSAMPLE * SUBSAMPLE) != n_x)
-+    return NULL; /* overflow, bail */
-+
-+  n_weights *= n_y;
-+  if (n_weights / (SUBSAMPLE * SUBSAMPLE * n_x) != n_y)
-+    return NULL; /* overflow, bail */
-+
-+  weights = g_try_new (int, n_weights);
-+  if (!weights)
-+    return NULL; /* overflow, bail */
- 
-   for (i_offset=0; i_offset < SUBSAMPLE; i_offset++)
-     for (j_offset=0; j_offset < SUBSAMPLE; j_offset++)
-@@ -1347,8 +1360,11 @@ pixops_process (guchar         *dest_buf,
-   if (x_step == 0 || y_step == 0)
-     return; /* overflow, bail out */
- 
--  line_bufs = g_new (guchar *, filter->y.n);
-   filter_weights = make_filter_table (filter);
-+  if (!filter_weights)
-+    return; /* overflow, bail out */
-+
-+  line_bufs = g_new (guchar *, filter->y.n);
- 
-   check_shift = check_size ? get_check_shift (check_size) : 0;
- 
-@@ -1468,7 +1484,7 @@ tile_make_weights (PixopsFilterDimension *dim,
- 		   double                 scale)
- {
-   int n = ceil (1 / scale + 1);
--  double *pixel_weights = g_new (double, SUBSAMPLE * n);
-+  double *pixel_weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
-   int offset;
-   int i;
- 
-@@ -1526,7 +1542,7 @@ bilinear_magnify_make_weights (PixopsFilterDimension *dim,
-     }
- 
-   dim->n = n;
--  dim->weights = g_new (double, SUBSAMPLE * n);
-+  dim->weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
- 
-   pixel_weights = dim->weights;
- 
-@@ -1617,7 +1633,7 @@ bilinear_box_make_weights (PixopsFilterDimension *dim,
- 			   double                 scale)
- {
-   int n = ceil (1/scale + 3.0);
--  double *pixel_weights = g_new (double, SUBSAMPLE * n);
-+  double *pixel_weights = g_malloc_n (sizeof (double) * SUBSAMPLE, n);
-   double w;
-   int offset, i;
- 
diff --git a/SPECS/gdk-pixbuf2.spec b/SPECS/gdk-pixbuf2.spec
index 1c80464..db1c7aa 100644
--- a/SPECS/gdk-pixbuf2.spec
+++ b/SPECS/gdk-pixbuf2.spec
@@ -1,20 +1,20 @@
-%global glib2_version 2.34.0
+%global glib2_version 2.37.6
 
 Name:           gdk-pixbuf2
-Version:        2.28.2
-Release:        5%{?dist}
+Version:        2.31.6
+Release:        3%{?dist}
 Summary:        An image loading library
 
 Group:          System Environment/Libraries
 License:        LGPLv2+
 URL:            http://www.gt.org
 #VCS:           git:git://git.gnome.org/gdk-pixbuf
-Source0:        http://download.gnome.org/sources/gdk-pixbuf/2.28/gdk-pixbuf-%{version}.tar.xz
+Source0:        http://download.gnome.org/sources/gdk-pixbuf/2.31/gdk-pixbuf-%{version}.tar.xz
 
-# upstream fix
-Patch0: 0001-Make-update-cache-work-better.patch
-# https://bugzilla.redhat.com/show_bug.cgi?id=1253213
-Patch1: cve-2015-4491.patch
+Patch0: 0001-pixops-Chane-variable-type.patch
+Patch1: 0002-pixops-Be-smarter-than-gcc-s-optimizer.patch
+Patch2: 0001-pixops-Fail-make_weights-functions-on-OOM.patch
+Patch3: 0001-Skip-tests-when-we-can-t-run-them-due-to-lack-of-mem.patch
 
 BuildRequires:  glib2-devel >= %{glib2_version}
 BuildRequires:  libpng-devel
@@ -30,7 +30,7 @@ BuildRequires:  shared-mime-info
 BuildRequires: autoconf automake libtool gtk-doc
 BuildRequires: gettext-autopoint
 
-Requires: glib2 >= %{glib2_version}
+Requires: glib2%{?_isa} >= %{glib2_version}
 
 # We also need MIME information at runtime
 Requires: shared-mime-info
@@ -46,8 +46,8 @@ clutter.
 %package devel
 Summary: Development files for gdk-pixbuf
 Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
-Requires: glib2-devel >= %{glib2_version}
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: glib2-devel%{?_isa} >= %{glib2_version}
 
 # gdk-pixbuf was included in gtk2 until 2.21.2
 Conflicts: gtk2-devel <= 2.21.2
@@ -56,18 +56,31 @@ Conflicts: gtk2-devel <= 2.21.2
 This package contains the libraries and header files that are needed
 for writing applications that are using gdk-pixbuf.
 
+%package tests
+Summary: Tests for the %{name} package
+Group: Development/Libraries
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description tests
+The %{name}-tests package contains tests that can be used to verify
+the functionality of the installed %{name} package.
+
 
 %prep
 %setup -q -n gdk-pixbuf-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 %build
 (if ! test -x configure; then NOCONFIGURE=1 ./autogen.sh; CONFIGFLAGS=--enable-gtk-doc; fi;
  %configure $CONFIGFLAGS             \
         --with-x11                   \
         --with-libjasper             \
-        --with-included-loaders=png  )
+        --with-included-loaders=png  \
+        --enable-installed-tests
+)
 make %{?_smp_mflags}
 
 
@@ -122,11 +135,29 @@ fi
 %{_datadir}/gtk-doc/html/*
 %{_mandir}/man1/gdk-pixbuf-csource.1*
 
+%files tests
+%{_libexecdir}/installed-tests
+%{_datadir}/installed-tests
+
 
 %changelog
-* Wed Aug 19 2015 Benjamin Otte <otte@redhat.com> - 2.28.2-5
-- Fix CVE 2015-4491
-- Resolves #1253213
+* Tue Sep 22 2015 Benjamin Otte <otte@gnome.org> - 2.31.6-3
+- Fix testsuite more
+- Resolves: #1264466
+
+* Mon Sep 21 2015 Matthias Clasen <mclasen@redhat.com> - 2.31.6-2
+- Fix testsuite
+- Resolves: #1264466
+
+* Wed Aug 19 2015 Benjamin Otte <otte@redhat.com> - 2.31.6-1
+- Update to 2.31.6
+- Resolves: #1253214
+
+* Mon Apr 27 2015 Matthias Clasen <mclasen@redhat.com> - 2.31.1-1
+- Update to 2.31.1
+- Add a -tests subpackage
+- Drop an upstreamed patch
+- Resolves: #1174438
 
 * Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 2.28.2-4
 - Mass rebuild 2014-01-24