summaryrefslogtreecommitdiff
path: root/Build/source/texk/cjkutils
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/cjkutils')
-rw-r--r--Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/ChangeLog4
-rw-r--r--Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/patch-03-unsigned100
-rw-r--r--Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf.c16
-rw-r--r--Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf2gf.w8
-rw-r--r--Build/source/texk/cjkutils/hbf2gf.c8
-rw-r--r--Build/source/texk/cjkutils/hbf2gf.dvibin184396 -> 184536 bytes
-rw-r--r--Build/source/texk/cjkutils/hbf2gf.tex10
7 files changed, 126 insertions, 20 deletions
diff --git a/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/ChangeLog b/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/ChangeLog
index 92c96bdf931..8e45faff786 100644
--- a/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/ChangeLog
+++ b/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * patch-03-unsigned (new): Avoid undefined behaviour.
+
2012-12-07 Peter Breitenlohner <peb@mppmu.mpg.de>
* patch-02-unused (new): Drop unused variable (gcc-4.6 warning).
diff --git a/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/patch-03-unsigned b/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/patch-03-unsigned
new file mode 100644
index 00000000000..301bb0f6b42
--- /dev/null
+++ b/Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/patch-03-unsigned
@@ -0,0 +1,100 @@
+ Avoid undefined behaviour when char is signed.
+
+diff -ur cjkutils-4.8.3.orig/hbf2gf/hbf.c cjkutils-4.8.3/hbf2gf/hbf.c
+--- cjkutils-4.8.3.orig/hbf2gf/hbf.c 2012-12-07 10:57:31.000000000 +0100
++++ cjkutils-4.8.3/hbf2gf/hbf.c 2014-06-19 12:44:16.000000000 +0200
+@@ -378,7 +378,7 @@
+ lp++;
+ sp++;
+ }
+- return (*lp == '\0' || isspace(*lp)) && *sp == '\0';
++ return (*lp == '\0' || isspace((unsigned char)*lp)) && *sp == '\0';
+ }
+
+ #ifdef NO_STRDUP
+@@ -407,12 +407,12 @@
+ prop = NEW(PROPERTY);
+
+ tp = tmp;
+- while (*lp != '\0' && ! isspace(*lp))
++ while (*lp != '\0' && ! isspace((unsigned char)*lp))
+ *tp++ = *lp++;
+ *tp = '\0';
+ prop->prop_name = strdup(tmp);
+
+- while (*lp != '\0' && isspace(*lp))
++ while (*lp != '\0' && isspace((unsigned char)*lp))
+ lp++;
+
+ tp = tmp;
+@@ -423,9 +423,9 @@
+ }
+ else
+ for (;;) {
+- while (*lp != '\0' && ! isspace(*lp))
++ while (*lp != '\0' && ! isspace((unsigned char)*lp))
+ *tp++ = *lp++;
+- while (*lp != '\0' && isspace(*lp))
++ while (*lp != '\0' && isspace((unsigned char)*lp))
+ lp++;
+ if (*lp == '\0')
+ break;
+@@ -765,9 +765,9 @@
+ skip_word(int n, const char *s)
+ {
+ for ( ; n > 0; n--) {
+- while (*s != '\0' && ! isspace(*s))
++ while (*s != '\0' && ! isspace((unsigned char)*s))
+ s++;
+- while (*s != '\0' && isspace(*s))
++ while (*s != '\0' && isspace((unsigned char)*s))
+ s++;
+ }
+ return s;
+@@ -869,7 +869,7 @@
+ }
+ if (c == '\n' || c == '\r') {
+ /* trim trailing space */
+- while (bp > buf && isspace(*(bp-1)))
++ while (bp > buf && isspace((unsigned char)*(bp-1)))
+ bp--;
+ *bp = '\0';
+ return TRUE;
+diff -ur cjkutils-4.8.3.orig/hbf2gf/hbf2gf.w cjkutils-4.8.3/hbf2gf/hbf2gf.w
+--- cjkutils-4.8.3.orig/hbf2gf/hbf2gf.w 2012-05-20 14:09:25.000000000 +0200
++++ cjkutils-4.8.3/hbf2gf/hbf2gf.w 2014-06-19 12:44:16.000000000 +0200
+@@ -2330,7 +2330,7 @@
+
+ do
+ {Q = search_string;
+- p = tolower(*Q);
++ p = tolower((unsigned char)*Q);
+ Ch = fgetc(config);
+ ch = tolower(Ch);
+ while(!(ch == p && old_ch == '\n') && Ch != EOF)
+@@ -2347,7 +2347,7 @@
+ /* there must be a space or a tab stop after the keyword */
+ goto success;
+ Ch = fgetc(config);
+- if(tolower(Ch) != tolower(*Q))
++ if(tolower(Ch) != tolower((unsigned char)*Q))
+ break;
+ }
+ }
+@@ -2410,14 +2410,14 @@
+ }
+ while(*P == '{') @q } @>
+ P++;
+- if(!(isalpha(*P) || *P == '_'))
++ if(!(isalpha((unsigned char)*P) || *P == '_'))
+ {fprintf(stderr,@/
+ "Invalid environment variable name in configuration file\n");
+ exit(1);
+ }
+ *(env_p++) = *(P++);
+ while(*P)
+- {if(isalnum(*P) || *P == '_')
++ {if(isalnum((unsigned char)*P) || *P == '_')
+ *(env_p++) = *(P++);
+ else
+ {@q { @> while(*P == '}')
diff --git a/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf.c b/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf.c
index 1491a025727..dedb9650b21 100644
--- a/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf.c
+++ b/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf.c
@@ -378,7 +378,7 @@ match(reg const char *lp, reg const char *sp)
lp++;
sp++;
}
- return (*lp == '\0' || isspace(*lp)) && *sp == '\0';
+ return (*lp == '\0' || isspace((unsigned char)*lp)) && *sp == '\0';
}
#ifdef NO_STRDUP
@@ -407,12 +407,12 @@ reg char *tp;
prop = NEW(PROPERTY);
tp = tmp;
- while (*lp != '\0' && ! isspace(*lp))
+ while (*lp != '\0' && ! isspace((unsigned char)*lp))
*tp++ = *lp++;
*tp = '\0';
prop->prop_name = strdup(tmp);
- while (*lp != '\0' && isspace(*lp))
+ while (*lp != '\0' && isspace((unsigned char)*lp))
lp++;
tp = tmp;
@@ -423,9 +423,9 @@ reg char *tp;
}
else
for (;;) {
- while (*lp != '\0' && ! isspace(*lp))
+ while (*lp != '\0' && ! isspace((unsigned char)*lp))
*tp++ = *lp++;
- while (*lp != '\0' && isspace(*lp))
+ while (*lp != '\0' && isspace((unsigned char)*lp))
lp++;
if (*lp == '\0')
break;
@@ -765,9 +765,9 @@ static const char *
skip_word(int n, const char *s)
{
for ( ; n > 0; n--) {
- while (*s != '\0' && ! isspace(*s))
+ while (*s != '\0' && ! isspace((unsigned char)*s))
s++;
- while (*s != '\0' && isspace(*s))
+ while (*s != '\0' && isspace((unsigned char)*s))
s++;
}
return s;
@@ -869,7 +869,7 @@ get_line(char *buf, int len, FILE *f)
}
if (c == '\n' || c == '\r') {
/* trim trailing space */
- while (bp > buf && isspace(*(bp-1)))
+ while (bp > buf && isspace((unsigned char)*(bp-1)))
bp--;
*bp = '\0';
return TRUE;
diff --git a/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf2gf.w b/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf2gf.w
index ca4f3f0856d..20663537a94 100644
--- a/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf2gf.w
+++ b/Build/source/texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf2gf.w
@@ -2330,7 +2330,7 @@ static int fsearch(const char *search_string)
do
{Q = search_string;
- p = tolower(*Q);
+ p = tolower((unsigned char)*Q);
Ch = fgetc(config);
ch = tolower(Ch);
while(!(ch == p && old_ch == '\n') && Ch != EOF)
@@ -2347,7 +2347,7 @@ static int fsearch(const char *search_string)
/* there must be a space or a tab stop after the keyword */
goto success;
Ch = fgetc(config);
- if(tolower(Ch) != tolower(*Q))
+ if(tolower(Ch) != tolower((unsigned char)*Q))
break;
}
}
@@ -2410,14 +2410,14 @@ directories for the \.{pk\_directory} and the \.{tfm\_directory} keywords.
}
while(*P == '{') @q } @>
P++;
- if(!(isalpha(*P) || *P == '_'))
+ if(!(isalpha((unsigned char)*P) || *P == '_'))
{fprintf(stderr,@/
"Invalid environment variable name in configuration file\n");
exit(1);
}
*(env_p++) = *(P++);
while(*P)
- {if(isalnum(*P) || *P == '_')
+ {if(isalnum((unsigned char)*P) || *P == '_')
*(env_p++) = *(P++);
else
{@q { @> while(*P == '}')
diff --git a/Build/source/texk/cjkutils/hbf2gf.c b/Build/source/texk/cjkutils/hbf2gf.c
index 7a39b24b2ec..598b86cd765 100644
--- a/Build/source/texk/cjkutils/hbf2gf.c
+++ b/Build/source/texk/cjkutils/hbf2gf.c
@@ -2008,7 +2008,7 @@ rewind(config);
do
{Q= search_string;
-p= tolower(*Q);
+p= tolower((unsigned char)*Q);
Ch= fgetc(config);
ch= tolower(Ch);
while(!(ch==p&&old_ch=='\n')&&Ch!=EOF)
@@ -2025,7 +2025,7 @@ if((Ch= fgetc(config))==' '||Ch=='\t')
goto success;
Ch= fgetc(config);
-if(tolower(Ch)!=tolower(*Q))
+if(tolower(Ch)!=tolower((unsigned char)*Q))
break;
}
}
@@ -2065,14 +2065,14 @@ continue;
}
while(*P=='{')
P++;
-if(!(isalpha(*P)||*P=='_'))
+if(!(isalpha((unsigned char)*P)||*P=='_'))
{fprintf(stderr,
"Invalid environment variable name in configuration file\n");
exit(1);
}
*(env_p++)= *(P++);
while(*P)
-{if(isalnum(*P)||*P=='_')
+{if(isalnum((unsigned char)*P)||*P=='_')
*(env_p++)= *(P++);
else
{while(*P=='}')
diff --git a/Build/source/texk/cjkutils/hbf2gf.dvi b/Build/source/texk/cjkutils/hbf2gf.dvi
index 48a6b494be9..2f7999c07ce 100644
--- a/Build/source/texk/cjkutils/hbf2gf.dvi
+++ b/Build/source/texk/cjkutils/hbf2gf.dvi
Binary files differ
diff --git a/Build/source/texk/cjkutils/hbf2gf.tex b/Build/source/texk/cjkutils/hbf2gf.tex
index 02aeba3c2af..7b5c879ff08 100644
--- a/Build/source/texk/cjkutils/hbf2gf.tex
+++ b/Build/source/texk/cjkutils/hbf2gf.tex
@@ -2434,7 +2434,7 @@ ${}\{{}$\1\6
\&{do}\5
${}\{{}$\1\6
${}\|Q\K\\{search\_string};{}$\6
-${}\|p\K\\{tolower}({*}\|Q);{}$\6
+${}\|p\K\\{tolower}{}$((\&{unsigned} \&{char}) ${}{*}\|Q);{}$\6
${}\\{Ch}\K\\{fgetc}(\\{config});{}$\6
${}\\{ch}\K\\{tolower}(\\{Ch});{}$\6
\&{while} ${}(\R(\\{ch}\E\|p\W\\{old\_ch}\E\.{'\\n'})\W\\{Ch}\I\.{EOF}{}$)\C{
@@ -2452,7 +2452,8 @@ ${}\{{}$\1\6
there must be a space or a tab stop after the keyword }\1\6
\&{goto} \\{success};\2\2\6
${}\\{Ch}\K\\{fgetc}(\\{config});{}$\6
-\&{if} ${}(\\{tolower}(\\{Ch})\I\\{tolower}({*}\|Q)){}$\1\5
+\&{if} ${}(\\{tolower}(\\{Ch})\I\\{tolower}{}$((\&{unsigned} \&{char}) ${}{*}%
+\|Q)){}$\1\5
\&{break};\2\6
\4${}\}{}$\2\6
\4${}\}{}$\2\5
@@ -2518,7 +2519,8 @@ ${}\\{count}\MM;{}$\6
\4${}\}{}$\2\6
\&{while} ${}({*}\|P\E\.{'\{'}){}$\1\5
${}\|P\PP;{}$\2\6
-\&{if} ${}(\R(\\{isalpha}({*}\|P)\V{*}\|P\E\.{'\_'})){}$\5
+\&{if} ${}(\R{}$(\\{isalpha}((\&{unsigned} \&{char}) ${}{*}\|P)\V{*}\|P\E\.{'%
+\_'})){}$\5
${}\{{}$\1\6
${}\\{fprintf}(\\{stderr},{}$\6
\.{"Invalid\ environment}\)\.{\ variable\ name\ in\ co}\)\.{nfiguration\ file%
@@ -2528,7 +2530,7 @@ ${}\\{fprintf}(\\{stderr},{}$\6
${}{*}(\\{env\_p}\PP)\K{*}(\|P\PP);{}$\6
\&{while} ${}({*}\|P){}$\5
${}\{{}$\1\6
-\&{if} ${}(\\{isalnum}({*}\|P)\V{*}\|P\E\.{'\_'}){}$\1\5
+\&{if} (\\{isalnum}((\&{unsigned} \&{char}) ${}{*}\|P)\V{*}\|P\E\.{'\_'}){}$\1\5
${}{*}(\\{env\_p}\PP)\K{*}(\|P\PP);{}$\2\6
\&{else}\5
${}\{{}$\1\6