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