--- gdk-pixbuf-2.34.0/gdk-pixbuf/io-ico.c	2015-11-24 04:13:06.000000000 +0100
+++ gdk-pixbuf-2.34.0-fix-ico-assert/gdk-pixbuf/io-ico.c	2016-07-04 18:55:24.530336366 +0200
@@ -258,8 +258,13 @@
 		State->HeaderBuf = tmp;
  		State->BytesInHeaderBuf = State->HeaderSize;
  	}
- 	if (Bytes < State->HeaderSize)
+ 	if (Bytes < State->HeaderSize) {
+		g_set_error_literal (error,
+                                     GDK_PIXBUF_ERROR,
+                                     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                     _("Not enough bytes for header"));
  		return;
+	}
 
 	/* Now iterate through the ICONDIRENTRY structures, and sort them by
 	 * which one we think is "best" (essentially the largest) */
@@ -399,8 +404,13 @@
 		State->HeaderBuf = tmp;
  		State->BytesInHeaderBuf = State->HeaderSize;
  	}
- 	if (Bytes < State->HeaderSize)
+ 	if (Bytes < State->HeaderSize) {
+		g_set_error_literal (error,
+                                     GDK_PIXBUF_ERROR,
+                                     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                     _("Not enough bytes for header"));
  		return;
+	}
 
 	/* Negative heights mean top-down pixel-order */
 	if (State->Header.height < 0) {
