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