Blame SOURCES/libgxps-0.3.0-archive-handle-error.patch

dcdbf8
From 133fe2a96e020d4ca65c6f64fb28a404050ebbfd Mon Sep 17 00:00:00 2001
dcdbf8
From: Carlos Garcia Campos <carlosgc@gnome.org>
dcdbf8
Date: Sat, 5 May 2018 12:02:36 +0200
dcdbf8
Subject: gxps-archive: Handle errors returned by archive_read_data
dcdbf8
dcdbf8
dcdbf8
diff --git a/libgxps/gxps-archive.c b/libgxps/gxps-archive.c
dcdbf8
index 346ba73..1bae729 100644
dcdbf8
--- a/libgxps/gxps-archive.c
dcdbf8
+++ b/libgxps/gxps-archive.c
dcdbf8
@@ -520,6 +520,13 @@ gxps_archive_input_stream_read (GInputStream  *stream,
dcdbf8
 		return -1;
dcdbf8
 
dcdbf8
         bytes_read = archive_read_data (istream->zip->archive, buffer, count);
dcdbf8
+        if (bytes_read < 0) {
dcdbf8
+                g_set_error_literal (error,
dcdbf8
+                                     G_IO_ERROR,
dcdbf8
+                                     g_io_error_from_errno (archive_errno (istream->zip->archive)),
dcdbf8
+                                     archive_error_string (istream->zip->archive));
dcdbf8
+                return -1;
dcdbf8
+        }
dcdbf8
         if (bytes_read == 0 && istream->is_interleaved && !gxps_archive_input_stream_is_last_piece (istream)) {
dcdbf8
                 /* Read next piece */
dcdbf8
                 gxps_archive_input_stream_next_piece (istream);