[gimp] file-pdf-load: Fix possible uninitialised variable access
- From: Mukund Sivaraman <muks src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] file-pdf-load: Fix possible uninitialised variable access
- Date: Wed, 7 Dec 2011 12:54:31 +0000 (UTC)
commit 7f0e71dbf2debb27b71d1f54106411382420f8e4
Author: Karthikeyan S <karthikdevel gmail com>
Date: Wed Dec 7 17:57:28 2011 +0530
file-pdf-load: Fix possible uninitialised variable access
Print a message to the user if poppler returns n_pages = 0.
Return to file open dialog.
This way we prevent uninitialised variable access down the line.
plug-ins/common/file-pdf-load.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 00c78f5..4138e74 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -1101,6 +1101,13 @@ load_dialog (PopplerDocument *doc,
gtk_widget_show (selector);
n_pages = poppler_document_get_n_pages (doc);
+
+ if (n_pages <= 0)
+ {
+ gimp_message (_("Error getting number of pages from the given pdf file\n"));
+ return FALSE;
+ }
+
gimp_page_selector_set_n_pages (GIMP_PAGE_SELECTOR (selector), n_pages);
gimp_page_selector_set_target (GIMP_PAGE_SELECTOR (selector),
loadvals.target);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]