[evince] comics: Fix decoding some files in RAR archives
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] comics: Fix decoding some files in RAR archives
- Date: Wed, 12 Jul 2017 13:51:34 +0000 (UTC)
commit 499cd2025bc21ca725915f0e0b618bf8df2a0596
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jul 12 12:53:19 2017 +0200
comics: Fix decoding some files in RAR archives
The unarr RAR decoder doesn't like it when we request more data than is
available:
! rar.c:169: Requesting too much data (3563 < 10240)
Clamp the size of the read request to the data left to read.
https://bugzilla.gnome.org/show_bug.cgi?id=784842
backend/comics/comics-document.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index ee06009..a913641 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -318,14 +318,19 @@ comics_document_get_page_size (EvDocument *document,
if (g_strcmp0 (name, page_path) == 0) {
char buf[BLOCK_SIZE];
gssize read;
+ gint64 left;
- read = ev_archive_read_data (comics_document->archive, buf, sizeof(buf), &error);
+ left = ev_archive_get_entry_size (comics_document->archive);
+ read = ev_archive_read_data (comics_document->archive, buf,
+ MIN(BLOCK_SIZE, left), &error);
while (read > 0 && !info.got_info) {
if (!gdk_pixbuf_loader_write (loader, (guchar *) buf, read, &error)) {
read = -1;
break;
}
- read = ev_archive_read_data (comics_document->archive, buf, BLOCK_SIZE,
&error);
+ left -= read;
+ read = ev_archive_read_data (comics_document->archive, buf,
+ MIN(BLOCK_SIZE, left), &error);
}
if (read < 0) {
g_warning ("Fatal error reading '%s' in archive: %s", name, error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]