[Gimp-developer] Fix possible uninitialized variable access



-Karthik
From c840d2113346f97990f1c7b967963c16349fd6f2 Mon Sep 17 00:00:00 2001
From: karthik <karthikdevel gmail com>
Date: Wed, 7 Dec 2011 08:08:42 +0530
Subject: [PATCH] Fix possible uninitialised variable access

Print a message to the user if poppler returns n_pages = 0.
Return to file open dialog.
---
 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..27d4a16 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 )
+  {
+    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);
-- 
1.7.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]