1b60d7
--- evince-3.28.2/backend/comics/comics-document.c
1b60d7
+++ evince-3.28.2/backend/comics/comics-document.c
1b60d7
@@ -453,23 +453,27 @@ comics_document_render_pixbuf (EvDocumen
1b60d7
 
1b60d7
 		name = ev_archive_get_entry_pathname (comics_document->archive);
1b60d7
 		if (g_strcmp0 (name, page_path) == 0) {
1b60d7
-			size_t size = ev_archive_get_entry_size (comics_document->archive);
1b60d7
+			gint64 size = ev_archive_get_entry_size (comics_document->archive);
1b60d7
 			char *buf;
1b60d7
 			ssize_t read;
1b60d7
 
1b60d7
-			buf = g_malloc (size);
1b60d7
-			read = ev_archive_read_data (comics_document->archive, buf, size, &error);
1b60d7
-			if (read <= 0) {
1b60d7
-				if (read < 0) {
1b60d7
-					g_warning ("Fatal error reading '%s' in archive: %s", name, error->message);
1b60d7
-					g_error_free (error);
1b60d7
+			if (size >= 0) {
1b60d7
+				buf = g_malloc (size);
1b60d7
+				read = ev_archive_read_data (comics_document->archive, buf, size, &error);
1b60d7
+				if (read <= 0) {
1b60d7
+					if (read < 0) {
1b60d7
+						g_warning ("Fatal error reading '%s' in archive: %s", name, error->message);
1b60d7
+						g_error_free (error);
1b60d7
+					} else {
1b60d7
+						g_warning ("Read an empty file from the archive");
1b60d7
+					}
1b60d7
 				} else {
1b60d7
-					g_warning ("Read an empty file from the archive");
1b60d7
+					gdk_pixbuf_loader_write (loader, (guchar *) buf, size, NULL);
1b60d7
 				}
1b60d7
+				g_free (buf);
1b60d7
 			} else {
1b60d7
-				gdk_pixbuf_loader_write (loader, (guchar *) buf, size, NULL);
1b60d7
+				g_warning ("Fatal error reading '%s' in archive", name);
1b60d7
 			}
1b60d7
-			g_free (buf);
1b60d7
 			gdk_pixbuf_loader_close (loader, NULL);
1b60d7
 			break;
1b60d7
 		}