summaryrefslogtreecommitdiff
path: root/Build/source/texk/chktex
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-19 11:14:35 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-19 11:14:35 +0000
commite5b8a1a0369901d3d73384cf553619d9351679aa (patch)
treea0b0d02bb0421b6f6f1dce118d40dfe6e91147b6 /Build/source/texk/chktex
parenta7803f3483864a647563ebda46f5fa39a92bb205 (diff)
texk/*/, utils/*/: Avoid undefined behaviour when char is signed
git-svn-id: svn://tug.org/texlive/trunk@34310 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/chktex')
-rw-r--r--Build/source/texk/chktex/chktex-1.7.2-PATCHES/ChangeLog5
-rw-r--r--Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-01-sequence-point14
-rw-r--r--Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-02-unsigned14
-rw-r--r--Build/source/texk/chktex/chktex-1.7.2/FindErrs.c4
4 files changed, 35 insertions, 2 deletions
diff --git a/Build/source/texk/chktex/chktex-1.7.2-PATCHES/ChangeLog b/Build/source/texk/chktex/chktex-1.7.2-PATCHES/ChangeLog
index dcde8acf28d..eb1f0d5d0a4 100644
--- a/Build/source/texk/chktex/chktex-1.7.2-PATCHES/ChangeLog
+++ b/Build/source/texk/chktex/chktex-1.7.2-PATCHES/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-01-sequence-point (new): Avoid an undefined operation.
+ * patch-02-unsigned (new): Avoid undefined behaviour.
+
2013-05-30 Peter Breitenlohner <peb@mppmu.mpg.de>
Import chktex-1.7.2.
diff --git a/Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-01-sequence-point b/Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-01-sequence-point
new file mode 100644
index 00000000000..469c1fa77ca
--- /dev/null
+++ b/Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-01-sequence-point
@@ -0,0 +1,14 @@
+ Avoid an operation that may be undefined.
+
+diff -ur chktex-1.7.2.orig/FindErrs.c chktex-1.7.2/FindErrs.c
+--- chktex-1.7.2.orig/FindErrs.c 2013-04-18 05:43:10.000000000 +0200
++++ chktex-1.7.2/FindErrs.c 2014-06-19 11:19:40.000000000 +0200
+@@ -1171,7 +1171,7 @@
+ tmp = stpcpy(tmp, SilentCase.Stack.Data[i]);
+ *tmp++ = '|';
+ }
+- tmp = stpcpy(--tmp, ")");
++ tmp = stpcpy(tmp - 1, ")");
+
+ SilentRegex = malloc( sizeof(regex_t) );
+ rc = regcomp(SilentRegex, pattern, REGEX_FLAGS);
diff --git a/Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-02-unsigned b/Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-02-unsigned
new file mode 100644
index 00000000000..bced537d868
--- /dev/null
+++ b/Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-02-unsigned
@@ -0,0 +1,14 @@
+ Avoid undefined behaviour when char is signed.
+
+diff -ur chktex-1.7.2.orig/FindErrs.c chktex-1.7.2/FindErrs.c
+--- chktex-1.7.2.orig/FindErrs.c 2014-06-19 11:19:40.000000000 +0200
++++ chktex-1.7.2/FindErrs.c 2014-06-19 11:21:36.000000000 +0200
+@@ -342,7 +342,7 @@
+ EscapePtr = ++TmpPtr; /* move past NUL terminator */
+ while ( *EscapePtr )
+ {
+- *EscapePtr = tolower(*EscapePtr);
++ *EscapePtr = tolower((unsigned char)*EscapePtr);
+ ++EscapePtr;
+ }
+
diff --git a/Build/source/texk/chktex/chktex-1.7.2/FindErrs.c b/Build/source/texk/chktex/chktex-1.7.2/FindErrs.c
index 7a1c6e24c80..ad4a6d944fa 100644
--- a/Build/source/texk/chktex/chktex-1.7.2/FindErrs.c
+++ b/Build/source/texk/chktex/chktex-1.7.2/FindErrs.c
@@ -342,7 +342,7 @@ static char *PreProcess(void)
EscapePtr = ++TmpPtr; /* move past NUL terminator */
while ( *EscapePtr )
{
- *EscapePtr = tolower(*EscapePtr);
+ *EscapePtr = tolower((unsigned char)*EscapePtr);
++EscapePtr;
}
@@ -1171,7 +1171,7 @@ int CheckSilentRegex(void)
tmp = stpcpy(tmp, SilentCase.Stack.Data[i]);
*tmp++ = '|';
}
- tmp = stpcpy(--tmp, ")");
+ tmp = stpcpy(tmp - 1, ")");
SilentRegex = malloc( sizeof(regex_t) );
rc = regcomp(SilentRegex, pattern, REGEX_FLAGS);