[poppler] utils/pdfimages.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 27 22:37:28 UTC 2019


 utils/pdfimages.cc |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 72f5509211438a7e5e1f1e2290fb6cbda2b923c9
Author: Hartmut Goebel <h.goebel at crazy-compilers.com>
Date:   Tue Dec 24 13:46:25 2019 +0000

    pdfimages: Add error message if first page is larger then number of pages.

diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc
index 5e5fde78..6ae92b34 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -22,6 +22,7 @@
 // Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
 // Copyright (C) 2019 Oliver Sander <oliver.sander at tu-dresden.de>
+// Copyright (C) 2019 Hartmut Goebel <h.goebel at crazy-compilers.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -191,6 +192,12 @@ int main(int argc, char *argv[]) {
   // get page range
   if (firstPage < 1)
     firstPage = 1;
+  if (firstPage > doc->getNumPages()) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be larger then the number of pages in the document ({1:d}).",
+          firstPage, doc->getNumPages());
+    goto err1;
+  }
   if (lastPage < 1 || lastPage > doc->getNumPages())
     lastPage = doc->getNumPages();
   if (lastPage < firstPage) {


More information about the poppler mailing list