summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2013-12-07 16:56:11 +0000
committerAlbert Astals Cid <aacid@kde.org>2013-12-07 16:56:11 +0000
commitf77bc21813ae7234ec4ce94ce4e92230fe5c174a (patch)
treec4aa3bc9a1413b060992e9fdc428f3b289cc5bd1 /utils
parent06e9dc917650f562cd6f6666190a8c25756514a3 (diff)
parent58e04a08afee39370283c494ee2e4e392fd3b684 (diff)
Merge remote-tracking branch 'origin/poppler-0.24'
Conflicts: utils/pdfimages.cc utils/pdfinfo.cc utils/pdfseparate.cc
Diffstat (limited to 'utils')
-rw-r--r--utils/pdffonts.cc7
-rw-r--r--utils/pdfimages.cc7
-rw-r--r--utils/pdfinfo.cc7
-rw-r--r--utils/pdfseparate.cc7
-rw-r--r--utils/pdftocairo.cc7
-rw-r--r--utils/pdftohtml.cc6
-rw-r--r--utils/pdftoppm.cc7
-rw-r--r--utils/pdftops.cc7
-rw-r--r--utils/pdftotext.cc7
9 files changed, 62 insertions, 0 deletions
diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc
index 820abbf7..535bf8fb 100644
--- a/utils/pdffonts.cc
+++ b/utils/pdffonts.cc
@@ -17,6 +17,7 @@
// Copyright (C) 2007-2008, 2010 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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 96709ed7..563839e1 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -19,6 +19,7 @@
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2010 Jakob Voss <jakob.voss@gbv.de>
// Copyright (C) 2012, 2013 Adrian Johnson <ajohnson@redneon.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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
@@ -188,6 +189,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, listImages);
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 22d9edd9..5a9745fa 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -20,6 +20,7 @@
// Copyright (C) 2012, 2013 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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
@@ -207,6 +208,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 dcb59f6b..78dbf129 100644
--- a/utils/pdfseparate.cc
+++ b/utils/pdfseparate.cc
@@ -8,6 +8,7 @@
// Copyright (C) 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2013 Pino Toscano <pino@kde.org>
// Copyright (C) 2013 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
//
//========================================================================
#include "config.h"
@@ -70,6 +71,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;
+ }
bool foundmatch = false;
char *p = strstr(auxDestFileName, "%d");
if (p != NULL) {
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index f6ddaaeb..6c677bda 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -27,6 +27,7 @@
// Copyright (C) 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2012 Koji Otani <sho@bbr.jp>
// Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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 af7251cb..8ce0430a 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -326,6 +326,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 a3d4d10b..962860b1 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -25,6 +25,7 @@
// Copyright (C) 2010 William Bader <williambader@hotmail.com>
// Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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
@@ -425,6 +426,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 7f5a0ce3..cbe1d367 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -22,6 +22,7 @@
// Copyright (C) 2009, 2011, 2012 William Bader <williambader@hotmail.com>
// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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 5eb2b414..15c741d3 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -23,6 +23,7 @@
// Copyright (C) 2011 Tom Gleason <tom@buildadam.com>
// Copyright (C) 2011 Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk>
// Copyright (C) 2013 Yury G. Kudryashov <urkud.urkud@gmail.com>
+// Copyright (C) 2013 Suzuki Toshiya <mpsuzuki@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
@@ -290,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) {