[poppler] Branch 'poppler-0.24' - 2 commits - utils/pdffonts.cc utils/pdfimages.cc utils/pdfinfo.cc utils/pdfseparate.cc utils/pdftocairo.cc utils/pdftohtml.cc utils/pdftoppm.cc utils/pdftops.cc utils/pdftotext.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Nov 26 15:06:18 PST 2013


 utils/pdffonts.cc    |    7 +++++++
 utils/pdfimages.cc   |    7 +++++++
 utils/pdfinfo.cc     |    7 +++++++
 utils/pdfseparate.cc |    7 +++++++
 utils/pdftocairo.cc  |    7 +++++++
 utils/pdftohtml.cc   |    8 +++++++-
 utils/pdftoppm.cc    |    7 +++++++
 utils/pdftops.cc     |    7 +++++++
 utils/pdftotext.cc   |    7 +++++++
 9 files changed, 63 insertions(+), 1 deletion(-)

New commits:
commit a42a13be0a0cda71dc230a73f7b16eb4eb066251
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Wed Nov 27 00:05:57 2013 +0100

    Warn the user if he provides a wrong range

diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc
index 820abbf..535bf8f 100644
--- a/utils/pdffonts.cc
+++ b/utils/pdffonts.cc
@@ -17,6 +17,7 @@
 // Copyright (C) 2007-2008, 2010 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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
@@ -150,6 +151,12 @@ int main(int argc, char *argv[]) {
   if (lastPage < 1 || lastPage > doc->getNumPages()) {
     lastPage = doc->getNumPages();
   }
+  if (lastPage < firstPage) {
+    fprintf(stderr,
+            "Wrong page range given: the first page (%d) can not be after the last page (%d).\n",
+            firstPage, lastPage);
+    goto err1;
+  }
 
   // get the fonts
   {
diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc
index 82c301c..e898985 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -19,6 +19,7 @@
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2010 Jakob Voss <jakob.voss at gbv.de>
 // Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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
@@ -166,6 +167,12 @@ int main(int argc, char *argv[]) {
     firstPage = 1;
   if (lastPage < 1 || lastPage > doc->getNumPages())
     lastPage = doc->getNumPages();
+  if (lastPage < firstPage) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+          firstPage, lastPage);
+    goto err1;
+  }
 
   // write image files
   imgOut = new ImageOutputDev(imgRoot, pageNames, dumpJPEG, listImages);
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 14e4f6c..68fbd20 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -19,6 +19,7 @@
 // Copyright (C) 2011 Vittal Aithal <vittal.aithal at cognidox.com>
 // Copyright (C) 2012, 2013 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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
@@ -202,6 +203,12 @@ int main(int argc, char *argv[]) {
   if (lastPage < 1 || lastPage > doc->getNumPages()) {
     lastPage = doc->getNumPages();
   }
+  if (lastPage < firstPage) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+          firstPage, lastPage);
+    goto err2;
+  }
 
   // print doc info
   doc->getDocInfo(&info);
diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc
index d7efcf0..d93ca3e 100644
--- a/utils/pdfseparate.cc
+++ b/utils/pdfseparate.cc
@@ -7,6 +7,7 @@
 // Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2012, 2013 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2013 Pino Toscano <pino at kde.org>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 //========================================================================
 #include "config.h"
@@ -63,6 +64,12 @@ bool extractPages (const char *srcFileName, const char *destFileName) {
     lastPage = doc->getNumPages();
   if (firstPage == 0)
     firstPage = 1;
+  if (lastPage < firstPage) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+          firstPage, lastPage);
+    return false;
+  }
   if (firstPage != lastPage && strstr(destFileName, "%d") == NULL) {
     error(errSyntaxError, -1, "'{0:s}' must contain '%d' if more than one page should be extracted", destFileName);
     return false;
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index e1fb258..86e413c 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -27,6 +27,7 @@
 // Copyright (C) 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2012 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2013 Lu Wang <coolwanglu at gmail.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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
@@ -964,6 +965,12 @@ int main(int argc, char *argv[]) {
   if (lastPage < 1 || lastPage > doc->getNumPages())
     lastPage = doc->getNumPages();
 
+  if (lastPage < firstPage) {
+    fprintf(stderr,
+            "Wrong page range given: the first page (%d) can not be after the last page (%d).\n",
+            firstPage, lastPage);
+    exit(99);
+  }
   if (eps && firstPage != lastPage) {
     fprintf(stderr, "EPS files can only contain one page.\n");
     exit(99);
diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index bcec8cb..5f39e95 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -16,7 +16,7 @@
 // Copyright (C) 2007-2008, 2010, 2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2010 Mike Slegeir <tehpola at yahoo.com>
-// Copyright (C) 2010 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
+// Copyright (C) 2010, 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac at cdacmumbai.in) and Onkar Potdar (onkar at cdacmumbai.in)
 // Copyright (C) 2011 Steven Murdoch <Steven.Murdoch at cl.cam.ac.uk>
 // Copyright (C) 2012 Igor Slepchin <igor.redhat at gmail.com>
@@ -322,6 +322,12 @@ int main(int argc, char *argv[]) {
     firstPage = 1;
   if (lastPage < 1 || lastPage > doc->getNumPages())
     lastPage = doc->getNumPages();
+  if (lastPage < firstPage) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+          firstPage, lastPage);
+    goto error;
+  }
 
   doc->getDocInfo(&info);
   if (info.isDict()) {
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 73f337c..e5138d1 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -25,6 +25,7 @@
 // Copyright (C) 2010 William Bader <williambader at hotmail.com>
 // Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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
@@ -412,6 +413,12 @@ int main(int argc, char *argv[]) {
     lastPage = firstPage;
   if (lastPage < 1 || lastPage > doc->getNumPages())
     lastPage = doc->getNumPages();
+  if (lastPage < firstPage) {
+    fprintf(stderr,
+            "Wrong page range given: the first page (%d) can not be after the last page (%d).\n",
+            firstPage, lastPage);
+    goto err1;
+  }
 
   if (singleFile && firstPage < lastPage) {
     if (!quiet) {
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 7f5a0ce..cbe1d36 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -22,6 +22,7 @@
 // Copyright (C) 2009, 2011, 2012 William Bader <williambader at hotmail.com>
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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
@@ -380,6 +381,12 @@ int main(int argc, char *argv[]) {
   if (lastPage < 1 || lastPage > doc->getNumPages()) {
     lastPage = doc->getNumPages();
   }
+  if (lastPage < firstPage) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+          firstPage, lastPage);
+    goto err2;
+  }
 
   // check for multi-page EPS or form
   if ((doEPS || doForm) && firstPage != lastPage) {
diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 91661d9..7ab6cdd 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -291,6 +291,12 @@ int main(int argc, char *argv[]) {
   if (lastPage < 1 || lastPage > doc->getNumPages()) {
     lastPage = doc->getNumPages();
   }
+  if (lastPage < firstPage) {
+    error(errCommandLine, -1,
+          "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).",
+          firstPage, lastPage);
+    goto err3;
+  }
 
   // write HTML header
   if (htmlMeta) {
commit 45552cafaeef6b883078db269437586add1dc32c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 26 23:36:12 2013 +0100

    Update copyrights

diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index bd687ec..91661d9 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -23,6 +23,7 @@
 // Copyright (C) 2011 Tom Gleason <tom at buildadam.com>
 // Copyright (C) 2011 Steven Murdoch <Steven.Murdoch at cl.cam.ac.uk>
 // Copyright (C) 2013 Yury G. Kudryashov <urkud.urkud at gmail.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 //
 // 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


More information about the poppler mailing list