From 9fc78897eff42414ea25ce52cf8585015c980c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Poo-Caama=C3=B1o?= Date: Thu, 30 May 2013 18:05:36 -0700 Subject: libview: Check number of pages on ev_view_document_changed_cb Fix crash on corrupted PDF with no pages. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- libview/ev-view.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libview') diff --git a/libview/ev-view.c b/libview/ev-view.c index a2f368d8..8c7c8520 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -6769,12 +6769,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; + ev_view_set_loading (view, FALSE); - g_object_ref (view->document); setup_caches (view); } -- cgit v1.2.1