summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorGermán Poo-Caamaño <[email protected]>2013-05-30 18:05:36 -0700
committermonsta <[email protected]>2018-04-03 17:20:35 +0300
commit7bba877d2283a9bef1beba35e101a279b98b7db7 (patch)
tree7ab9e70f9d29db7ba3201053b7c9c96cbc511e6f /libview
parent370cea480023260dfa0d2fe6b8d8ed93249264d9 (diff)
downloadatril-7bba877d2283a9bef1beba35e101a279b98b7db7.tar.bz2
atril-7bba877d2283a9bef1beba35e101a279b98b7db7.tar.xz
libview: Check number of pages on ev_view_document_changed_cb
Fix crash on corrupted PDF with no pages. Thanks to Juha Kylmänen from OUSPG who were testing robutness. (CVE-2013-3718). libview: Fix warning on ev_view_document_changed_cb There was an introduction of a warning when fixing the bug https://bugzilla.gnome.org/show_bug.cgi?id=701302 If ev_view_document_changed_cb () is emitted when there is no previous document, the check fails. This patch change the order of the condition checks. origin commits: https://git.gnome.org/browse/evince/commit/?h=gnome-3-8&id=62b1585 https://git.gnome.org/browse/evince/commit/?h=gnome-3-8&id=5431595
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index e1b060cc..5fbf12ff 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -5232,12 +5232,15 @@ ev_view_document_changed_cb (EvDocumentModel *model,
g_object_unref (view->document);
}
- view->document = document;
+ view->document = document ? g_object_ref (document) : NULL;
view->find_result = 0;
if (view->document) {
+ if (ev_document_get_n_pages (view->document) <= 0 ||
+ !ev_document_check_dimensions (view->document))
+ return;
+
view->loading = FALSE;
- g_object_ref (view->document);
setup_caches (view);
}