summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:32:02 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:32:02 +0000
commitc4b4327ea277956f2f6f73fbb9f4fae9fb283128 (patch)
treed048d29f975e3f759951b30fc7fb86d3dabe9745 /Build
parentc594597e3480253f361154c71491adf03bc896d3 (diff)
libpaper: Avoid undefined behaviour when char is signed
git-svn-id: svn://tug.org/texlive/trunk@34279 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/ChangeLog4
-rw-r--r--Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/patch-04-unsigned29
-rw-r--r--Build/source/libs/libpaper/libpaper-1.1.24+nmu2/lib/dimen.c4
-rw-r--r--Build/source/libs/libpaper/libpaper-1.1.24+nmu2/src/paperconf.c4
4 files changed, 37 insertions, 4 deletions
diff --git a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/ChangeLog b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/ChangeLog
index 8747ca1a3e3..88935dabef6 100644
--- a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/ChangeLog
+++ b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-04-unsigned (new): Avoid undefined behaviour.
+
2013-11-20 Peter Breitenlohner <peb@mppmu.mpg.de>
* patch-03-getopt (new): Adapt paperconf.1 to non-GNU getopt.
diff --git a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/patch-04-unsigned b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/patch-04-unsigned
new file mode 100644
index 00000000000..13c798bc1e5
--- /dev/null
+++ b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2-PATCHES/patch-04-unsigned
@@ -0,0 +1,29 @@
+diff -ur libpaper-1.1.24+nmu2.orig/lib/dimen.c libpaper-1.1.24+nmu2/lib/dimen.c
+--- libpaper-1.1.24+nmu2.orig/lib/dimen.c 2002-11-11 01:56:08.000000000 +0100
++++ libpaper-1.1.24+nmu2/lib/dimen.c 2014-06-18 08:31:52.000000000 +0200
+@@ -53,9 +53,9 @@
+
+ if (*(unit = what) == '-') ++unit;
+
+- for (; isdigit(*unit) || (*unit == '.' && !dot++); ++unit);
++ for (; isdigit((unsigned char)*unit) || (*unit == '.' && !dot++); ++unit);
+
+- if (*unit && !isalpha(*unit)) {
++ if (*unit && !isalpha((unsigned char)*unit)) {
+ return -1;
+ } else {
+ double base = atof(what);
+diff -ur libpaper-1.1.24+nmu2.orig/src/paperconf.c libpaper-1.1.24+nmu2/src/paperconf.c
+--- libpaper-1.1.24+nmu2.orig/src/paperconf.c 2012-05-03 21:05:12.000000000 +0200
++++ libpaper-1.1.24+nmu2/src/paperconf.c 2014-06-18 08:31:54.000000000 +0200
+@@ -53,8 +53,8 @@
+ printf("%s", papername(paper));
+ pr = 1;
+ } else if (options & OPT_UPPERNAME) {
+- if (islower(*papername(paper))) {
+- printf("%c%s", toupper(*papername(paper)), papername(paper) + 1);
++ if (islower((unsigned char)*papername(paper))) {
++ printf("%c%s", toupper((unsigned char)*papername(paper)), papername(paper) + 1);
+ } else {
+ printf("%s", papername(paper));
+ }
diff --git a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/lib/dimen.c b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/lib/dimen.c
index d0c86e20524..702d7937668 100644
--- a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/lib/dimen.c
+++ b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/lib/dimen.c
@@ -53,9 +53,9 @@ int psdimension(const char* what, int* dim)
if (*(unit = what) == '-') ++unit;
- for (; isdigit(*unit) || (*unit == '.' && !dot++); ++unit);
+ for (; isdigit((unsigned char)*unit) || (*unit == '.' && !dot++); ++unit);
- if (*unit && !isalpha(*unit)) {
+ if (*unit && !isalpha((unsigned char)*unit)) {
return -1;
} else {
double base = atof(what);
diff --git a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/src/paperconf.c b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/src/paperconf.c
index d0fa34fab2f..bbd43802512 100644
--- a/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/src/paperconf.c
+++ b/Build/source/libs/libpaper/libpaper-1.1.24+nmu2/src/paperconf.c
@@ -53,8 +53,8 @@ static void printinfo(const struct paper* paper, int options)
printf("%s", papername(paper));
pr = 1;
} else if (options & OPT_UPPERNAME) {
- if (islower(*papername(paper))) {
- printf("%c%s", toupper(*papername(paper)), papername(paper) + 1);
+ if (islower((unsigned char)*papername(paper))) {
+ printf("%c%s", toupper((unsigned char)*papername(paper)), papername(paper) + 1);
} else {
printf("%s", papername(paper));
}