From e5b8a1a0369901d3d73384cf553619d9351679aa Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 19 Jun 2014 11:14:35 +0000 Subject: texk/*/, utils/*/: Avoid undefined behaviour when char is signed git-svn-id: svn://tug.org/texlive/trunk@34310 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/afm2pl/ChangeLog | 5 +- Build/source/texk/afm2pl/afm2pl.c | 2 +- .../texk/chktex/chktex-1.7.2-PATCHES/ChangeLog | 5 + .../chktex-1.7.2-PATCHES/patch-01-sequence-point | 14 ++ .../chktex/chktex-1.7.2-PATCHES/patch-02-unsigned | 14 ++ Build/source/texk/chktex/chktex-1.7.2/FindErrs.c | 4 +- .../texk/cjkutils/cjkutils-4.8.3-PATCHES/ChangeLog | 4 + .../cjkutils-4.8.3-PATCHES/patch-03-unsigned | 100 +++++++++++++ .../texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf.c | 16 +- .../texk/cjkutils/cjkutils-4.8.3/hbf2gf/hbf2gf.w | 8 +- Build/source/texk/cjkutils/hbf2gf.c | 8 +- Build/source/texk/cjkutils/hbf2gf.dvi | Bin 184396 -> 184536 bytes Build/source/texk/cjkutils/hbf2gf.tex | 10 +- Build/source/texk/devnag/ChangeLog | 4 + Build/source/texk/devnag/src/devnag.c | 10 +- Build/source/texk/dviljk/ChangeLog | 4 + Build/source/texk/dviljk/dvi2xx.c | 2 +- Build/source/texk/dviljk/dvilj.man | 63 ++++---- Build/source/texk/dvipsk/ChangeLog | 5 + Build/source/texk/dvipsk/afm2tfm.c | 2 +- Build/source/texk/dvipsk/dospecial.c | 4 +- Build/source/texk/dvipsk/emspecial.c | 28 ++-- Build/source/texk/dvipsk/resident.c | 2 +- Build/source/texk/dvipsk/writet1.c | 4 +- Build/source/texk/gsftopk/ChangeLog | 4 + Build/source/texk/gsftopk/gsftopk.c | 14 +- Build/source/texk/makeindexk/ChangeLog | 5 + Build/source/texk/makeindexk/genind.c | 4 +- Build/source/texk/makeindexk/scanid.c | 10 +- .../texk/psutils/psutils-1.23-PATCHES/ChangeLog | 4 + .../psutils/psutils-1.23-PATCHES/patch-02-unsigned | 83 +++++++++++ Build/source/texk/psutils/psutils-1.23/psselect.c | 8 +- Build/source/texk/psutils/psutils-1.23/psspec.c | 4 +- Build/source/texk/psutils/psutils-1.23/pstops.c | 2 +- Build/source/texk/psutils/psutils-1.23/psutil.c | 4 +- Build/source/texk/seetexk/ChangeLog | 4 + Build/source/texk/seetexk/dvitodvi.c | 8 +- Build/source/texk/xdvik/ChangeLog | 5 + Build/source/texk/xdvik/ft.c | 20 +-- Build/source/texk/xdvik/gui/xaw_menu.c | 2 +- Build/source/texk/xdvik/hypertex.c | 2 +- .../utils/t1utils/t1utils-1.38-PATCHES/ChangeLog | 4 + .../t1utils/t1utils-1.38-PATCHES/patch-06-unsigned | 161 +++++++++++++++++++++ Build/source/utils/t1utils/t1utils-1.38/t1asm.c | 18 +-- Build/source/utils/t1utils/t1utils-1.38/t1disasm.c | 4 +- Build/source/utils/t1utils/t1utils-1.38/t1lib.c | 12 +- Build/source/utils/t1utils/t1utils-1.38/t1mac.c | 8 +- 47 files changed, 567 insertions(+), 141 deletions(-) create mode 100644 Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-01-sequence-point create mode 100644 Build/source/texk/chktex/chktex-1.7.2-PATCHES/patch-02-unsigned create mode 100644 Build/source/texk/cjkutils/cjkutils-4.8.3-PATCHES/patch-03-unsigned create mode 100644 Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned create mode 100644 Build/source/utils/t1utils/t1utils-1.38-PATCHES/patch-06-unsigned (limited to 'Build/source') diff --git a/Build/source/texk/afm2pl/ChangeLog b/Build/source/texk/afm2pl/ChangeLog index f47e7bc065c..f5288f93ee6 100644 --- a/Build/source/texk/afm2pl/ChangeLog +++ b/Build/source/texk/afm2pl/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * afm2pl.c: Avoid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. @@ -7,7 +11,6 @@ Incorporated patches for the man page from Eric S. Raymond - 2012-12-07 Peter Breitenlohner * afm2pl.c: Drop unused variable (gcc-4.6 warning). diff --git a/Build/source/texk/afm2pl/afm2pl.c b/Build/source/texk/afm2pl/afm2pl.c index 6f7514eb30c..07cff18a3a4 100644 --- a/Build/source/texk/afm2pl/afm2pl.c +++ b/Build/source/texk/afm2pl/afm2pl.c @@ -1821,7 +1821,7 @@ writepl(void) tbuf[39] = 0; } tbp = tbuf; - while (*tbp) { *tbp = toupper (*tbp); tbp++; } + while (*tbp) { *tbp = toupper ((unsigned char)*tbp); tbp++; } ploutln2 ("(CODINGSCHEME %s)", tbuf); } ploutln ("(DESIGNSIZE R 10.0)"); 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 + + * patch-01-sequence-point (new): Avoid an undefined operation. + * patch-02-unsigned (new): Avoid undefined behaviour. + 2013-05-30 Peter Breitenlohner 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); 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 + + * patch-03-unsigned (new): Avoid undefined behaviour. + 2012-12-07 Peter Breitenlohner * 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 Binary files a/Build/source/texk/cjkutils/hbf2gf.dvi and b/Build/source/texk/cjkutils/hbf2gf.dvi 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 diff --git a/Build/source/texk/devnag/ChangeLog b/Build/source/texk/devnag/ChangeLog index c8a9594973b..16f605965d9 100644 --- a/Build/source/texk/devnag/ChangeLog +++ b/Build/source/texk/devnag/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * src/devnag.c: Avoid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/devnag/src/devnag.c b/Build/source/texk/devnag/src/devnag.c index 71ee0993d0b..af163c83ff3 100644 --- a/Build/source/texk/devnag/src/devnag.c +++ b/Build/source/texk/devnag/src/devnag.c @@ -1172,7 +1172,7 @@ char *getsubarg(void) { while (subcom[i] != '{') i++; i++; while (subcom[i] == ' ') i++; - while (isalpha(subcom[i])) com[j++]= subcom[i++]; + while (isalpha((unsigned char)subcom[i])) com[j++]= subcom[i++]; com[j] = 0; i = 0; result = (char*) malloc (strlen(com)+1); @@ -1737,7 +1737,7 @@ void dnproc(void) { /* ------------------ End Addition ----------------- */ - if (!isalpha(symbol)) sendchar(symbol); + if (!isalpha((unsigned char)symbol)) sendchar(symbol); else { nbchcomm = 0; /* Marc Csernel */ do { @@ -1745,7 +1745,7 @@ void dnproc(void) { sendchar(symbol); symbol = inp_ch(); } - while (isalpha(symbol)); + while (isalpha((unsigned char)symbol)); /* --------- Addition by Marc Csernel 1998 --------- */ @@ -2242,7 +2242,7 @@ void sendchar(char c) { int i = strlen(word); word[i] = c == end_of_line ? '\n' : c; word[i+1] = '\0'; - if (isspace(c)) put_word(); + if (isspace((unsigned char)c)) put_word(); } /* @@ -2464,7 +2464,7 @@ char find_dn(void) { again = FALSE; dn_ptr = strstr(svbuf, "{\\dn"); if (dn_ptr != NULL) { - again = isalpha(dn_ptr[4]); + again = isalpha((unsigned char)dn_ptr[4]); svbuf = dn_ptr+4; } } diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog index 227ce0a945e..98681efb569 100644 --- a/Build/source/texk/dviljk/ChangeLog +++ b/Build/source/texk/dviljk/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * dvi2xx.c: Avoid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/dviljk/dvi2xx.c b/Build/source/texk/dviljk/dvi2xx.c index c8ce1be36df..df5dddff557 100644 --- a/Build/source/texk/dviljk/dvi2xx.c +++ b/Build/source/texk/dviljk/dvi2xx.c @@ -4241,7 +4241,7 @@ bool GetKeyVal(KeyWord *kw, KeyDesc tab[], int nt, int *tno) bool IsSame(const char *a, const char *b) { for (; *a; a++, b++) - if ( tolower(*a) != tolower(*b) ) + if ( tolower((unsigned char)*a) != tolower((unsigned char)*b) ) return( _FALSE ); return( *a == *b ? _TRUE : _FALSE ); diff --git a/Build/source/texk/dviljk/dvilj.man b/Build/source/texk/dviljk/dvilj.man index 93c8a45802c..33bed66f023 100644 --- a/Build/source/texk/dviljk/dvilj.man +++ b/Build/source/texk/dviljk/dvilj.man @@ -1,15 +1,7 @@ -.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp @@ -46,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -53,20 +47,27 @@ .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -149,9 +150,9 @@ dvilj4, dvilj4l, dvilj2p, dvilj \- convert a TeX DVI file to PCL, for HP LaserJe .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" -\&\fBdvilj\fR and siblings convert TeX-output \f(CW\*(C`.dvi\*(C'\fR files into \s-1PCL\s0 (the +\&\fBdvilj\fR and siblings convert TeX-output \f(CW\*(C`.dvi\*(C'\fR files into \s-1PCL \s0(the Hewlett-Packard Printer Control Language) commands suitable for -printing on a \s-1HP\s0 LaserJet+, \s-1HP\s0 LaserJet \s-1IIP\s0 (using \fBdvilj2p\fR), \s-1HP\s0 +printing on a \s-1HP\s0 LaserJet+, \s-1HP\s0 LaserJet \s-1IIP \s0(using \fBdvilj2p\fR), \s-1HP\s0 LaserJet 4 (using \fBdvilj4\fR), and fully compatible printers. .PP \&\fBdvilj4\fR also provides support for the builtin Intellifont and @@ -257,7 +258,7 @@ Specify the page size: \& \-s100: International B5 (176mm x 250mm) .Ve .Sp -These values are from the \s-1PCL\s0 5 technical reference manual. If the +These values are from the \s-1PCL 5\s0 technical reference manual. If the \&\fB\-s\fR commandline option is omitted, no clipping is performed at the bottom of the page. (But printing below the paper bottom should not disturb any correctly behaving \s-1PCL\s0 printer.) Please remember that the @@ -346,7 +347,7 @@ of the file content. \fIfile\fR is searched with \fIkpathsea\fR\|(3), see below. This is mostly used to keep absolute positions in \s-1PCL\s0 files. .IP "\fBpsfile\fR=\fIfile\fR \fBllx\fR=\fIx0\fR \fBlly\fR=\fIy0\fR \fBurx\fR=\fIx1\fR \fBury\fR=\fIy1\fR \fBrwi\fR=\fIs\fR" 4 .IX Item "psfile=file llx=x0 lly=y0 urx=x1 ury=y1 rwi=s" -Convert Postscript file \fIfile\fR to \s-1HP\s0 \s-1PCL\s0, by Ghostscript with device +Convert Postscript file \fIfile\fR to \s-1HP PCL,\s0 by Ghostscript with device \&\f(CW\*(C`ljetplus\*(C'\fR, and insert the resulting graphics file at the current position, rewriting absolute position escape sequences. \fIfile\fR is searched with \fIkpathsea\fR\|(3), see below. @@ -505,7 +506,7 @@ and we won't fix any problems with it.\fR It should be noted that the special parser does sometimes accept constructs that are not valid as in the documentation above. Then, the output is most often damaged in some way. -.Sh "Searching for Included Files" +.SS "Searching for Included Files" .IX Subsection "Searching for Included Files" Proper file include specials search the file with \fIkpathsea\fR\|(3). The search path is configured by variable \f(CW\*(C`DVILJINPUTS\*(C'\fR and, if the file @@ -518,8 +519,8 @@ graphics as part of ones current document. .PP \&\f(CW\*(C`dvilj\*(C'\fR is used as the \f(CW\*(C`.PROGRAM\*(C'\fR name in \fItexmf.cnf\fR, for all driver variants, independent of the actual program name. -.ie n .Sh "Unknown Specials and ""TEX_HUSH"" configuration" -.el .Sh "Unknown Specials and \f(CWTEX_HUSH\fP configuration" +.ie n .SS "Unknown Specials and ""TEX_HUSH"" configuration" +.el .SS "Unknown Specials and \f(CWTEX_HUSH\fP configuration" .IX Subsection "Unknown Specials and TEX_HUSH configuration" \&\fIKpathsea\fR\|(3) has the concept of warning suppression with the configuration variable \f(CW\*(C`TEX_HUSH\*(C'\fR, please refer to its Info node @@ -542,7 +543,7 @@ in doublepage mode, that is, roughly speaking, printing first the even pages and then the odd pages of a document. If \fB\-D\fR is used to print both even and odd pages (\fB\-D\fR is used without the optional 1 or 2) the following will happen after half of the pages is printed: \s-1LJ:\s0 the -printer stops, shows message \*(L"\s-1FEED\s0\*(R" and switches on manual feed led. +printer stops, shows message \*(L"\s-1FEED\*(R"\s0 and switches on manual feed led. The printer continues when either the printed pages are fed into the manual page feeder, or the operator pushes the continue button (after placing first the printed pages into the paper tray). @@ -564,7 +565,7 @@ page. .PP The doubleside option works for all LJs, not only for the new D model with does doubleside-printing (actually, I don't know whether it makes -much sense on the new \s-1LJ\s0 \s-1II\s0 D at all). +much sense on the new \s-1LJ II D\s0 at all). .PP Caveat on the doubleside-option: When it is used frequently or on very large files, it might become necessary to clean the printer much more @@ -646,7 +647,7 @@ compilation the texk build environment is needed, from As of July 2007, \s-1PCL\s0 reference documentation is found at \s-1HP\s0's Web site at . -At the end of that page are links to reference manuals for \s-1PCL\s0 and \s-1PJL\s0. +At the end of that page are links to reference manuals for \s-1PCL\s0 and \s-1PJL.\s0 .PP In case that page is changed, here are the URLs of these documents. All have the form @@ -654,11 +655,11 @@ All have the form where \f(CW\*(C`\*(C'\fR is the following document \s-1ID:\s0 .IP "\fB13205\fR" 4 .IX Item "13205" -\&\s-1PCL\s0 5 Technical Quick Reference Guide. This is the 1st thing to look up +\&\s-1PCL 5\s0 Technical Quick Reference Guide. This is the 1st thing to look up if you have questions about \s-1PCL\s0 escape sequences. .IP "\fB13210\fR and \fB13211\fR" 4 .IX Item "13210 and 13211" -\&\s-1PCL\s0 5 Technical Reference Manual (part I and \s-1II\s0). This is the +\&\s-1PCL 5\s0 Technical Reference Manual (part I and \s-1II\s0). This is the full-detailled explanation that you need to look up if you don't understand how the printer works. Part I is the actual manual, part \s-1II\s0 explains \s-1HP\-GL/2\s0 and has overall tips. @@ -667,7 +668,7 @@ explains \s-1HP\-GL/2\s0 and has overall tips. \&\s-1PJL\s0 Technical Reference Manual (and addendum) .IP "\fB13212\fR" 4 .IX Item "13212" -\&\s-1PCL\s0 5 Color Manual. This explains color specials for the newer \s-1HP\s0 +\&\s-1PCL 5\s0 Color Manual. This explains color specials for the newer \s-1HP\s0 printers. (Not of much use today; for practical purposes we would need to add color specials to \fBdvilj\fR first.) .IP "\fB13206\fR and \fB13209\fR" 4 diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index b20cd49c960..f48fa8e99a3 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Peter Breitenlohner + + * afm2tfm.c, dospecial.c, emspecial.c, resident.c, writet1.c: + Avoid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner * {,squeeze/}Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/dvipsk/afm2tfm.c b/Build/source/texk/dvipsk/afm2tfm.c index ec6b219b7d6..e57417b5a09 100644 --- a/Build/source/texk/dvipsk/afm2tfm.c +++ b/Build/source/texk/dvipsk/afm2tfm.c @@ -826,7 +826,7 @@ upmap(void) { /* Compute uppercase mapping, when making a small caps font */ Looks like we should use isupper to me --karl. */ for (Ai=adobechars; Ai; Ai=Ai->next) { p = Ai->adobename; - if (isupper (*p)) { + if (isupper ((unsigned char)*p)) { q = lwr; for (; *p; p++) *q++ = TOLOWER (*p); diff --git a/Build/source/texk/dvipsk/dospecial.c b/Build/source/texk/dvipsk/dospecial.c index 9986ec83daa..b295c643e5d 100644 --- a/Build/source/texk/dvipsk/dospecial.c +++ b/Build/source/texk/dvipsk/dospecial.c @@ -787,7 +787,7 @@ case 'h': if (strncmp(p, "html:", 5)==0) { if (! HPS_FLAG) return; p += 5; - while (isspace(*p)) + while (isspace((unsigned char)*p)) p++; if (*p == '<') { char *sp = p; @@ -802,7 +802,7 @@ case 'h': strncpy(str,sp+1,ii-1); str[ii-1] = 0;len=strlen(str); if(len>6) lower_len=6; else lower_len=len; - for(ii=0;ii= sizeof(emstr)) { fprintf(stderr, "em:graph: special too long, truncating\n"); break; @@ -285,14 +285,14 @@ char *emp; emstr[i] = '\0'; /* now get optional width and height */ emwidth = emheight = -1.0; /* no dimension is <= 0 */ - for (; *emp && ( isspace(*emp) || (*emp==',') ); emp++) + for (; *emp && ( isspace((unsigned char)*emp) || (*emp==',') ); emp++) ; /* skip blanks and comma */ if (*emp) { sscanf(emp, "%f%2s", &emwidth, emunit); /* read width */ emwidth = emunits(emwidth,emunit); /* convert to pixels */ - for (; *emp && (*emp=='.'||isdigit(*emp)||isalpha(*emp)); emp++) + for (; *emp && (*emp=='.'||isdigit((unsigned char)*emp)||isalpha((unsigned char)*emp)); emp++) ; /* skip width dimension */ - for (; *emp && ( isspace(*emp) || (*emp==',') ); emp++) + for (; *emp && ( isspace((unsigned char)*emp) || (*emp==',') ); emp++) ; /* skip blanks and comma */ if (*emp) { sscanf(emp, "%f%2s", &emheight, emunit); /* read height */ diff --git a/Build/source/texk/dvipsk/resident.c b/Build/source/texk/dvipsk/resident.c index 2212fe7b554..a7b496d8cda 100644 --- a/Build/source/texk/dvipsk/resident.c +++ b/Build/source/texk/dvipsk/resident.c @@ -642,7 +642,7 @@ case 'R': lastresortsizes[i] = 32000; #else /* KPATHSEA */ for (p = was_inline + 1; *p; p++) { - if (isblank (*p)) { + if (isblank ((unsigned char)*p)) { *p = ':'; } } diff --git a/Build/source/texk/dvipsk/writet1.c b/Build/source/texk/dvipsk/writet1.c index cf4e32e3fdd..460c477c5f5 100644 --- a/Build/source/texk/dvipsk/writet1.c +++ b/Build/source/texk/dvipsk/writet1.c @@ -479,7 +479,7 @@ static float t1_scan_num(char *p, char **r) pdftex_fail("a number expected: `%s'", t1_line_array); } if (r != NULL) { - for (; isdigit(*p) || *p == '.' || + for (; isdigit((unsigned char)*p) || *p == '.' || *p == 'e' || *p == 'E' || *p == '+' || *p == '-'; p++); *r = p; } @@ -1329,7 +1329,7 @@ static void t1_flush_cs(boolean is_subr) t1_line_ptr = t1_line_array; for (p = start_line; p - start_line < size_pos;) *t1_line_ptr++ = *p++; - while (isdigit(*p)) + while (isdigit((unsigned char)*p)) p++; sprintf(t1_line_ptr, "%u", count); strcat(t1_line_ptr, p); diff --git a/Build/source/texk/gsftopk/ChangeLog b/Build/source/texk/gsftopk/ChangeLog index e7cd02f0e09..a016de7d7e4 100644 --- a/Build/source/texk/gsftopk/ChangeLog +++ b/Build/source/texk/gsftopk/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * gsftopk.c: Avoid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/gsftopk/gsftopk.c b/Build/source/texk/gsftopk/gsftopk.c index 1e169887b6c..fd6f2d5243a 100644 --- a/Build/source/texk/gsftopk/gsftopk.c +++ b/Build/source/texk/gsftopk/gsftopk.c @@ -1380,7 +1380,7 @@ scan_map_file(FILE *f) { while (fgets_long(f)) if (memcmp(long_line, fontname, fontlen) == 0 - && (long_line[fontlen] == '\0' || isspace(long_line[fontlen]))) { + && (long_line[fontlen] == '\0' || isspace((unsigned char)long_line[fontlen]))) { fclose(f); return True; } @@ -1464,7 +1464,7 @@ whitespace(void) c = data_getc(); if (c == '#') do c = data_getc(); while (!data_eof && c != '\n'); - else if (!isspace(c)) { + else if (!isspace((unsigned char)c)) { data_ungetc(c); break; } @@ -1477,7 +1477,7 @@ getint(void) char c; int i = 0; - do c = data_getc(); while (isspace(c)); + do c = data_getc(); while (isspace((unsigned char)c)); if (c < '0' || c > '9') oops("digit expected"); do { i = i * 10 + (c - '0'); @@ -2317,7 +2317,7 @@ Author of gsftopk: Paul Vojta."); if (mapline != NULL) { if (memcmp(mapline, fontname, fontlen) != 0 - || (mapline[fontlen] != '\0' && !isspace(mapline[fontlen]))) + || (mapline[fontlen] != '\0' && !isspace((unsigned char)mapline[fontlen]))) oops("font name does not match --mapline argument"); } else { @@ -2382,7 +2382,7 @@ Author of gsftopk: Paul Vojta."); * Parse the line from the map file. */ for (p = mapline + fontlen; *p != '\0'; ++p) { - if (isspace(*p)) continue; + if (isspace((unsigned char)*p)) continue; if (*p == '<') { char *q; char endc; @@ -2395,7 +2395,7 @@ Author of gsftopk: Paul Vojta."); /* ... and maybe a '[' */ if (*p == '[') ++p; q = p; - while (*p != '\0' && !isspace(*p)) ++p; + while (*p != '\0' && !isspace((unsigned char)*p)) ++p; endc = *p; *p = '\0'; #ifdef KPATHSEA @@ -2434,7 +2434,7 @@ Author of gsftopk: Paul Vojta."); } else { PSname = p; - while (*p != '\0' && !isspace(*p)) ++p; + while (*p != '\0' && !isspace((unsigned char)*p)) ++p; if (*p == '\0') break; } *p = '\0'; diff --git a/Build/source/texk/makeindexk/ChangeLog b/Build/source/texk/makeindexk/ChangeLog index 7fd091ce39e..aa41ff9f11d 100644 --- a/Build/source/texk/makeindexk/ChangeLog +++ b/Build/source/texk/makeindexk/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Peter Breitenlohner + + * genind.c, scanid.c: Avoid undefined behaviour when char is + signed. + 2014-06-16 Peter Breitenlohner * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/makeindexk/genind.c b/Build/source/texk/makeindexk/genind.c index 61cbaa9480b..1d1ba03ad51 100644 --- a/Build/source/texk/makeindexk/genind.c +++ b/Build/source/texk/makeindexk/genind.c @@ -441,8 +441,8 @@ insert_page(void) while (pageno[i++] != NUL); j = --i; /* find the leftmost digit */ - while (isdigit(pageno[--i]) && i > 0); - if (!isdigit(pageno[i])) + while (isdigit((unsigned char)pageno[--i]) && i > 0); + if (!isdigit((unsigned char)pageno[i])) i++; /* convert page from literal to numeric */ page = strtoint(&pageno[i]) + 1; diff --git a/Build/source/texk/makeindexk/scanid.c b/Build/source/texk/makeindexk/scanid.c index ccb1bbd4342..8076a6be472 100644 --- a/Build/source/texk/makeindexk/scanid.c +++ b/Build/source/texk/makeindexk/scanid.c @@ -419,7 +419,7 @@ scan_no(char no[], int npg[], short *count, short *type) { int i = 1; - if (isdigit(no[0])) { + if (isdigit((unsigned char)no[0])) { *type = ARAB; if (!scan_arabic(no, npg, count)) return (FALSE); @@ -457,7 +457,7 @@ scan_arabic(char no[], int npg[], short *count) char str[ARABIC_MAX+1]; /* space for trailing NUL */ while ((no[i] != NUL) && (i <= ARABIC_MAX) && (!IS_COMPOSITOR)) { - if (isdigit(no[i])) { + if (isdigit((unsigned char)no[i])) { str[i] = no[i]; i++; } else { @@ -728,15 +728,15 @@ search_quote(char **sort_key, char **actual_key) { /* skip to umlaut or sharp S */ case 'a': case 'A': - sort = isupper(*(ptr + 1)) ? "Ae" : "ae"; + sort = isupper((unsigned char)*(ptr + 1)) ? "Ae" : "ae"; break; case 'o': case 'O': - sort = isupper(*(ptr + 1)) ? "Oe" : "oe"; + sort = isupper((unsigned char)*(ptr + 1)) ? "Oe" : "oe"; break; case 'u': case 'U': - sort = isupper(*(ptr + 1)) ? "Ue" : "ue"; + sort = isupper((unsigned char)*(ptr + 1)) ? "Ue" : "ue"; break; case 's': sort = "ss"; diff --git a/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog b/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog index 923c64493ff..c00f0d6efa7 100644 --- a/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog +++ b/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * patch-02-unsigned (new): Avoid undefined behaviour. + 2014-01-16 Peter Breitenlohner Import psutils-1.23. diff --git a/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned b/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned new file mode 100644 index 00000000000..97d13b3c290 --- /dev/null +++ b/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned @@ -0,0 +1,83 @@ + Avoid undefined behaviour when char is unsigned. + +diff -ur psutils-1.23.orig/psselect.c psutils-1.23/psselect.c +--- psutils-1.23.orig/psselect.c 2014-01-15 20:08:26.000000000 +0100 ++++ psutils-1.23/psselect.c 2014-06-19 12:56:34.000000000 +0200 +@@ -43,9 +43,9 @@ + if(!str) return NULL; + + sign = (*str == '_' && ++str) ? -1 : 1; +- if (isdigit(*str)) { ++ if (isdigit((unsigned char)*str)) { + first = sign*atoi(str); +- while (isdigit(*str)) str++; ++ while (isdigit((unsigned char)*str)) str++; + } + switch (*str) { + case '\0': +@@ -62,9 +62,9 @@ + sign = (*str == '_' && ++str) ? -1 : 1; + if (!first) + first = 1; +- if (isdigit(*str)) { ++ if (isdigit((unsigned char)*str)) { + int last = sign*atoi(str); +- while (isdigit(*str)) str++; ++ while (isdigit((unsigned char)*str)) str++; + if (*str == '\0') + return (makerange(first, last, rp)); + if (*str == ',') +diff -ur psutils-1.23.orig/psspec.c psutils-1.23/psspec.c +--- psutils-1.23.orig/psspec.c 2014-01-15 20:08:26.000000000 +0100 ++++ psutils-1.23/psspec.c 2014-06-19 12:56:34.000000000 +0200 +@@ -35,7 +35,7 @@ + char *s = *sp; + int num = atoi(s); + +- while (isdigit(*s)) ++ while (isdigit((unsigned char)*s)) + s++; + if (*sp == s) argerror(); + *sp = s; +@@ -47,7 +47,7 @@ + char *s = *sp; + double num = atof(s); + +- while (isdigit(*s) || *s == '-' || *s == '.') ++ while (isdigit((unsigned char)*s) || *s == '-' || *s == '.') + s++; + if (*sp == s) argerror(); + *sp = s; +diff -ur psutils-1.23.orig/pstops.c psutils-1.23/pstops.c +--- psutils-1.23.orig/pstops.c 2014-01-15 20:08:26.000000000 +0100 ++++ psutils-1.23/pstops.c 2014-06-19 12:56:34.000000000 +0200 +@@ -34,7 +34,7 @@ + + head = tail = newspec(); + while (*str) { +- if (isdigit(*str)) { ++ if (isdigit((unsigned char)*str)) { + num = parseint(&str); + } else { + switch (*str++) { +diff -ur psutils-1.23.orig/psutil.c psutils-1.23/psutil.c +--- psutils-1.23.orig/psutil.c 2014-01-16 08:57:40.000000000 +0100 ++++ psutils-1.23/psutil.c 2014-06-19 12:56:34.000000000 +0200 +@@ -258,7 +258,7 @@ + if (fgets(buffer, BUFSIZ, infile) != NULL && + iscomment(buffer, "%%Page:")) { + char *start, *end; +- for (start = buffer+7; isspace(*start); start++); ++ for (start = buffer+7; isspace((unsigned char)*start); start++); + if (*start == '(') { + int paren = 1; + for (end = start+1; paren > 0; end++) +@@ -275,7 +275,7 @@ + break; + } + } else +- for (end = start; !isspace(*end); end++); ++ for (end = start; !isspace((unsigned char)*end); end++); + strncpy(pagelabel, start, end-start); + pagelabel[end-start] = '\0'; + pageno = atoi(end); diff --git a/Build/source/texk/psutils/psutils-1.23/psselect.c b/Build/source/texk/psutils/psutils-1.23/psselect.c index 9440f0bb95b..55a4d0e7b1e 100644 --- a/Build/source/texk/psutils/psutils-1.23/psselect.c +++ b/Build/source/texk/psutils/psutils-1.23/psselect.c @@ -43,9 +43,9 @@ static PageRange *addrange(char *str, PageRange *rp) if(!str) return NULL; sign = (*str == '_' && ++str) ? -1 : 1; - if (isdigit(*str)) { + if (isdigit((unsigned char)*str)) { first = sign*atoi(str); - while (isdigit(*str)) str++; + while (isdigit((unsigned char)*str)) str++; } switch (*str) { case '\0': @@ -62,9 +62,9 @@ static PageRange *addrange(char *str, PageRange *rp) sign = (*str == '_' && ++str) ? -1 : 1; if (!first) first = 1; - if (isdigit(*str)) { + if (isdigit((unsigned char)*str)) { int last = sign*atoi(str); - while (isdigit(*str)) str++; + while (isdigit((unsigned char)*str)) str++; if (*str == '\0') return (makerange(first, last, rp)); if (*str == ',') diff --git a/Build/source/texk/psutils/psutils-1.23/psspec.c b/Build/source/texk/psutils/psutils-1.23/psspec.c index e02e6ffd3f6..19a31a6408f 100644 --- a/Build/source/texk/psutils/psutils-1.23/psspec.c +++ b/Build/source/texk/psutils/psutils-1.23/psspec.c @@ -35,7 +35,7 @@ int parseint(char **sp) char *s = *sp; int num = atoi(s); - while (isdigit(*s)) + while (isdigit((unsigned char)*s)) s++; if (*sp == s) argerror(); *sp = s; @@ -47,7 +47,7 @@ double parsedouble(char **sp) char *s = *sp; double num = atof(s); - while (isdigit(*s) || *s == '-' || *s == '.') + while (isdigit((unsigned char)*s) || *s == '-' || *s == '.') s++; if (*sp == s) argerror(); *sp = s; diff --git a/Build/source/texk/psutils/psutils-1.23/pstops.c b/Build/source/texk/psutils/psutils-1.23/pstops.c index c6b82b960ee..e37a0a27f60 100644 --- a/Build/source/texk/psutils/psutils-1.23/pstops.c +++ b/Build/source/texk/psutils/psutils-1.23/pstops.c @@ -34,7 +34,7 @@ static PageSpec *parsespecs(char *str) head = tail = newspec(); while (*str) { - if (isdigit(*str)) { + if (isdigit((unsigned char)*str)) { num = parseint(&str); } else { switch (*str++) { diff --git a/Build/source/texk/psutils/psutils-1.23/psutil.c b/Build/source/texk/psutils/psutils-1.23/psutil.c index 8533bff4906..f129341ed69 100644 --- a/Build/source/texk/psutils/psutils-1.23/psutil.c +++ b/Build/source/texk/psutils/psutils-1.23/psutil.c @@ -258,7 +258,7 @@ void seekpage(int p) if (fgets(buffer, BUFSIZ, infile) != NULL && iscomment(buffer, "%%Page:")) { char *start, *end; - for (start = buffer+7; isspace(*start); start++); + for (start = buffer+7; isspace((unsigned char)*start); start++); if (*start == '(') { int paren = 1; for (end = start+1; paren > 0; end++) @@ -275,7 +275,7 @@ void seekpage(int p) break; } } else - for (end = start; !isspace(*end); end++); + for (end = start; !isspace((unsigned char)*end); end++); strncpy(pagelabel, start, end-start); pagelabel[end-start] = '\0'; pageno = atoi(end); diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog index b0ba9981aaf..6fe58a4f598 100644 --- a/Build/source/texk/seetexk/ChangeLog +++ b/Build/source/texk/seetexk/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * dvitodvi.c: Avboid undefined behaviour when char is signed. + 2014-06-16 Peter Breitenlohner * Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/seetexk/dvitodvi.c b/Build/source/texk/seetexk/dvitodvi.c index ed76d6ae887..36bfaeac919 100644 --- a/Build/source/texk/seetexk/dvitodvi.c +++ b/Build/source/texk/seetexk/dvitodvi.c @@ -212,7 +212,7 @@ parseint(char **sp) neg = 1; s++; } - for (; isdigit(*s); s++) + for (; isdigit((unsigned char)*s); s++) n = n*10 + (*s-'0'); if (*sp == s) specusage(); *sp = s; @@ -231,12 +231,12 @@ parsedimen(char **sp) neg = 1; *sp = ++s; } - for (; isdigit(*s); s++) + for (; isdigit((unsigned char)*s); s++) whole = whole*10 + (*s-'0'); if (*s == '.') { *sp = ++s; - for (; isdigit(*s); s++) { + for (; isdigit((unsigned char)*s); s++) { if (den < 10000) { /* limit precision for scale to work */ num = num*10 + (*s-'0'); den *= 10; @@ -311,7 +311,7 @@ ParseSpecs(char *str, int make) else head = tail = &spare; while (*str) { - if (isdigit(*str)) { + if (isdigit((unsigned char)*str)) { num = parseint(&str); } else { switch (*str++) { diff --git a/Build/source/texk/xdvik/ChangeLog b/Build/source/texk/xdvik/ChangeLog index b5af6fd0449..ad44fa255c3 100644 --- a/Build/source/texk/xdvik/ChangeLog +++ b/Build/source/texk/xdvik/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Peter Breitenlohner + + * ft.c, gui/xaw_menu.c, hypertex.c: Avoid undefined behaviour + when char is signed. + 2014-06-16 Peter Breitenlohner * squeeze/Makefile.am: Drop the obsolete ACLOCAL_AMFLAGS. diff --git a/Build/source/texk/xdvik/ft.c b/Build/source/texk/xdvik/ft.c index 74ef96786e4..66ca6b55723 100644 --- a/Build/source/texk/xdvik/ft.c +++ b/Build/source/texk/xdvik/ft.c @@ -209,39 +209,39 @@ set_transform(struct ftfont *ftp, double y = 0.0; for (;;) { - while (isspace(*str)) ++str; + while (isspace((unsigned char)*str)) ++str; if (*str == '\0') break; - if (isdigit(*str) || *str == '.' || *str == '-') { + if (isdigit((unsigned char)*str) || *str == '.' || *str == '-') { double arg = strtod(str, (char **) &str); - while (isspace(*str)) ++str; + while (isspace((unsigned char)*str)) ++str; if (memcmp(str, "ObliqueSlant", 12) == 0 - && (isspace(str[12]) || str[12] == '\0')) { + && (isspace((unsigned char)str[12]) || str[12] == '\0')) { arg = -tan(arg); str += 12; - while (isspace(*str)) ++str; + while (isspace((unsigned char)*str)) ++str; } if (memcmp(str, "SlantFont", 9) == 0 - && (isspace(str[9]) || str[9] == '\0')) { + && (isspace((unsigned char)str[9]) || str[9] == '\0')) { y += arg; str += 9; } else if (memcmp(str, "ExtendFont", 10) == 0 - && (isspace(str[10]) || str[10] == '\0')) { + && (isspace((unsigned char)str[10]) || str[10] == '\0')) { x *= arg; str += 10; } else return False; } else { /* other characters; presume encoding name */ - while (!isspace(*str) && *str != '\0') ++str; - while (isspace(*str)) ++str; + while (!isspace((unsigned char)*str) && *str != '\0') ++str; + while (isspace((unsigned char)*str)) ++str; if (memcmp(str, "ReEncodeFont", 12) == 0 - && (isspace(str[12]) || str[12] == '\0')) + && (isspace((unsigned char)str[12]) || str[12] == '\0')) str += 12; else return False; diff --git a/Build/source/texk/xdvik/gui/xaw_menu.c b/Build/source/texk/xdvik/gui/xaw_menu.c index c1fbd45e2e2..cc3e8bcad95 100644 --- a/Build/source/texk/xdvik/gui/xaw_menu.c +++ b/Build/source/texk/xdvik/gui/xaw_menu.c @@ -406,7 +406,7 @@ filehist_select_cb(Widget w, XtPointer client_data, XtPointer call_data) XtVaGetValues(w, XtNlabel, &label, NULL); idx = strtol(label, &ptr, 10) - 1; - while (isspace(*ptr)) + while (isspace((unsigned char)*ptr)) ptr++; TRACE_GUI((stderr, "User selected: %d, `%s'", idx, ptr)); if (idx == 0) { diff --git a/Build/source/texk/xdvik/hypertex.c b/Build/source/texk/xdvik/hypertex.c index de4de61cf56..ac9d35934c1 100644 --- a/Build/source/texk/xdvik/hypertex.c +++ b/Build/source/texk/xdvik/hypertex.c @@ -1141,7 +1141,7 @@ scan_ps_literal_text_string(const char *str) case '\n': break; case '\r': if (*(str + 1) == '\n') str++; break; default: - if (isdigit(*str)) { + if (isdigit((unsigned char)*str)) { char number[] = "xxx"; char *end; strncpy(number, str, 3); diff --git a/Build/source/utils/t1utils/t1utils-1.38-PATCHES/ChangeLog b/Build/source/utils/t1utils/t1utils-1.38-PATCHES/ChangeLog index 3201d5690f9..5c3a503064b 100644 --- a/Build/source/utils/t1utils/t1utils-1.38-PATCHES/ChangeLog +++ b/Build/source/utils/t1utils/t1utils-1.38-PATCHES/ChangeLog @@ -1,3 +1,7 @@ +2014-06-19 Peter Breitenlohner + + * patch-06-unsigned (new): Avoid undefined behaviour. + 2013-11-22 Peter Breitenlohner * patch-05-getopt (new): Drop '#include '. diff --git a/Build/source/utils/t1utils/t1utils-1.38-PATCHES/patch-06-unsigned b/Build/source/utils/t1utils/t1utils-1.38-PATCHES/patch-06-unsigned new file mode 100644 index 00000000000..c355deb6c60 --- /dev/null +++ b/Build/source/utils/t1utils/t1utils-1.38-PATCHES/patch-06-unsigned @@ -0,0 +1,161 @@ + Avoid undefined behaviour when char is signed. + +diff -ur t1utils-1.38.orig/t1asm.c t1utils-1.38/t1asm.c +--- t1utils-1.38.orig/t1asm.c 2013-09-29 15:23:22.000000000 +0200 ++++ t1utils-1.38/t1asm.c 2014-06-19 13:08:40.000000000 +0200 +@@ -273,7 +273,7 @@ + static int check_line_charstring(void) + { + char *p = line; +- while (isspace(*p)) ++ while (isspace((unsigned char)*p)) + p++; + return (*p == '/' || (p[0] == 'd' && p[1] == 'u' && p[2] == 'p')); + } +@@ -359,8 +359,8 @@ + + static int is_integer(char *string) + { +- if (isdigit(string[0]) || string[0] == '-' || string[0] == '+') { +- while (*++string && isdigit(*string)) ++ if (isdigit((unsigned char)string[0]) || string[0] == '-' || string[0] == '+') { ++ while (*++string && isdigit((unsigned char)*string)) + ; /* deliberately empty */ + if (!*string) + return 1; +@@ -738,11 +738,11 @@ + t1utils_getline(); + + if (!ever_active) { +- if (strncmp(line, "currentfile eexec", 17) == 0 && isspace(line[17])) { ++ if (strncmp(line, "currentfile eexec", 17) == 0 && isspace((unsigned char)line[17])) { + /* Allow arbitrary whitespace after "currentfile eexec". + Thanks to Tom Kacvinsky for reporting this. + Note: strlen("currentfile eexec") == 17. */ +- for (p = line + 18; isspace(*p); p++) ++ for (p = line + 18; isspace((unsigned char)*p); p++) + ; + eexec_start(p); + continue; +@@ -756,7 +756,7 @@ + if (q) { + r = cs_start; + ++q; +- while (!isspace(*q) && *q != '{') ++ while (!isspace((unsigned char)*q) && *q != '{') + *r++ = *q++; + *r = '\0'; + } +@@ -765,9 +765,9 @@ + } + + if (!active) { +- if ((p = strstr(line, "/Subrs")) && isdigit(p[7])) ++ if ((p = strstr(line, "/Subrs")) && isdigit((unsigned char)p[7])) + ever_active = active = 1; +- else if ((p = strstr(line, "/CharStrings")) && isdigit(p[13])) ++ else if ((p = strstr(line, "/CharStrings")) && isdigit((unsigned char)p[13])) + ever_active = active = 1; + } + if ((p = strstr(line, "currentfile closefile"))) { +@@ -776,7 +776,7 @@ + /* 1/3/2002 -- happy new year! -- Luc Devroye reports a failure with + some printers when `currentfile closefile' is followed by space */ + p += sizeof("currentfile closefile") - 1; +- for (q = p; isspace(*q) && *q != '\n'; q++) ++ for (q = p; isspace((unsigned char)*q) && *q != '\n'; q++) + /* nada */; + if (q == p && !*q) + error("warning: `currentfile closefile' line too long"); +diff -ur t1utils-1.38.orig/t1disasm.c t1utils-1.38/t1disasm.c +--- t1utils-1.38.orig/t1disasm.c 2013-10-03 14:02:25.000000000 +0200 ++++ t1utils-1.38/t1disasm.c 2014-06-19 13:08:40.000000000 +0200 +@@ -100,7 +100,7 @@ + char *p = strstr(line, "/lenIV "); + + /* Allow lenIV to be negative. Thanks to Tom Kacvinsky */ +- if (p && (isdigit(p[7]) || p[7] == '+' || p[7] == '-')) { ++ if (p && (isdigit((unsigned char)p[7]) || p[7] == '+' || p[7] == '-')) { + lenIV = atoi(p + 7); + } + } +@@ -120,7 +120,7 @@ + if (q) { + r = cs_start; + ++q; +- while (!isspace(*q) && *q != '{') ++ while (!isspace((unsigned char)*q) && *q != '{') + *r++ = *q++; + *r = '\0'; + } +diff -ur t1utils-1.38.orig/t1lib.c t1utils-1.38/t1lib.c +--- t1utils-1.38.orig/t1lib.c 2013-09-29 15:23:22.000000000 +0200 ++++ t1utils-1.38/t1lib.c 2014-06-19 13:08:40.000000000 +0200 +@@ -59,7 +59,7 @@ + char *start = s; + char *t = s; + for (; *s; s++) { +- if (isspace(*s)) ++ if (isspace((unsigned char)*s)) + continue; + if (c1) { + *t++ = (hexval(c1) << 4) + hexval(*s); +@@ -136,10 +136,10 @@ + + /* now that we have the line, handle it */ + if (blocktyp == PFA_ASCII) { +- if (strncmp(line, "currentfile eexec", 17) == 0 && isspace(line[17])) { ++ if (strncmp(line, "currentfile eexec", 17) == 0 && isspace((unsigned char)line[17])) { + char saved_p; + /* assert(line == buffer); */ +- for (line += 18; isspace(*line); line++) ++ for (line += 18; isspace((unsigned char)*line); line++) + /* nada */; + saved_p = *line; + *line = 0; +@@ -158,12 +158,12 @@ + if (blocktyp == PFA_EEXEC_TEST) { + /* 8.Feb.2004: fix bug if first character in a binary eexec block + is 0, reported by Werner Lemberg */ +- for (; line < last && isspace(*line); line++) ++ for (; line < last && isspace((unsigned char)*line); line++) + /* nada */; + if (line == last) + continue; +- else if (last >= line + 4 && isxdigit(line[0]) && isxdigit(line[1]) +- && isxdigit(line[2]) && isxdigit(line[3])) ++ else if (last >= line + 4 && isxdigit((unsigned char)line[0]) && isxdigit((unsigned char)line[1]) ++ && isxdigit((unsigned char)line[2]) && isxdigit((unsigned char)line[3])) + blocktyp = PFA_HEX; + else + blocktyp = PFA_BINARY; +diff -ur t1utils-1.38.orig/t1mac.c t1utils-1.38/t1mac.c +--- t1utils-1.38.orig/t1mac.c 2013-09-29 15:23:22.000000000 +0200 ++++ t1utils-1.38/t1mac.c 2014-06-19 13:08:40.000000000 +0200 +@@ -370,10 +370,10 @@ + s[len-1] = '\r'; + t1mac_output_data((byte *)s, len); + if (strncmp(s, "/FontName", 9) == 0) { +- for (s += 9; isspace(*s); s++) ; ++ for (s += 9; isspace((unsigned char)*s); s++) ; + if (*s == '/') { + const char *t = ++s; +- while (*t && !isspace(*t)) t++; ++ while (*t && !isspace((unsigned char)*t)) t++; + free(font_name); + font_name = (char *)malloc(t - s + 1); + memcpy(font_name, s, t - s); +@@ -992,11 +992,11 @@ + int part = 0, len = 0; + char *x, *s; + for (x = s = font_name; *s; s++) +- if (isupper(*s) || isdigit(*s)) { ++ if (isupper((unsigned char)*s) || isdigit((unsigned char)*s)) { + *x++ = *s; + part++; + len = 1; +- } else if (islower(*s)) { ++ } else if (islower((unsigned char)*s)) { + if (len < (part <= 1 ? 5 : 3)) + *x++ = *s; + len++; diff --git a/Build/source/utils/t1utils/t1utils-1.38/t1asm.c b/Build/source/utils/t1utils/t1utils-1.38/t1asm.c index b29ecb486f5..27f45f27b23 100644 --- a/Build/source/utils/t1utils/t1utils-1.38/t1asm.c +++ b/Build/source/utils/t1utils/t1utils-1.38/t1asm.c @@ -273,7 +273,7 @@ static void eexec_start(char *string) static int check_line_charstring(void) { char *p = line; - while (isspace(*p)) + while (isspace((unsigned char)*p)) p++; return (*p == '/' || (p[0] == 'd' && p[1] == 'u' && p[2] == 'p')); } @@ -359,8 +359,8 @@ static int CDECL command_compare(const void *key, const void *item) static int is_integer(char *string) { - if (isdigit(string[0]) || string[0] == '-' || string[0] == '+') { - while (*++string && isdigit(*string)) + if (isdigit((unsigned char)string[0]) || string[0] == '-' || string[0] == '+') { + while (*++string && isdigit((unsigned char)*string)) ; /* deliberately empty */ if (!*string) return 1; @@ -738,11 +738,11 @@ particular purpose.\n"); t1utils_getline(); if (!ever_active) { - if (strncmp(line, "currentfile eexec", 17) == 0 && isspace(line[17])) { + if (strncmp(line, "currentfile eexec", 17) == 0 && isspace((unsigned char)line[17])) { /* Allow arbitrary whitespace after "currentfile eexec". Thanks to Tom Kacvinsky for reporting this. Note: strlen("currentfile eexec") == 17. */ - for (p = line + 18; isspace(*p); p++) + for (p = line + 18; isspace((unsigned char)*p); p++) ; eexec_start(p); continue; @@ -756,7 +756,7 @@ particular purpose.\n"); if (q) { r = cs_start; ++q; - while (!isspace(*q) && *q != '{') + while (!isspace((unsigned char)*q) && *q != '{') *r++ = *q++; *r = '\0'; } @@ -765,9 +765,9 @@ particular purpose.\n"); } if (!active) { - if ((p = strstr(line, "/Subrs")) && isdigit(p[7])) + if ((p = strstr(line, "/Subrs")) && isdigit((unsigned char)p[7])) ever_active = active = 1; - else if ((p = strstr(line, "/CharStrings")) && isdigit(p[13])) + else if ((p = strstr(line, "/CharStrings")) && isdigit((unsigned char)p[13])) ever_active = active = 1; } if ((p = strstr(line, "currentfile closefile"))) { @@ -776,7 +776,7 @@ particular purpose.\n"); /* 1/3/2002 -- happy new year! -- Luc Devroye reports a failure with some printers when `currentfile closefile' is followed by space */ p += sizeof("currentfile closefile") - 1; - for (q = p; isspace(*q) && *q != '\n'; q++) + for (q = p; isspace((unsigned char)*q) && *q != '\n'; q++) /* nada */; if (q == p && !*q) error("warning: `currentfile closefile' line too long"); diff --git a/Build/source/utils/t1utils/t1utils-1.38/t1disasm.c b/Build/source/utils/t1utils/t1utils-1.38/t1disasm.c index dcec63f5f80..40161a7fae5 100644 --- a/Build/source/utils/t1utils/t1utils-1.38/t1disasm.c +++ b/Build/source/utils/t1utils/t1utils-1.38/t1disasm.c @@ -100,7 +100,7 @@ set_lenIV(char *line) char *p = strstr(line, "/lenIV "); /* Allow lenIV to be negative. Thanks to Tom Kacvinsky */ - if (p && (isdigit(p[7]) || p[7] == '+' || p[7] == '-')) { + if (p && (isdigit((unsigned char)p[7]) || p[7] == '+' || p[7] == '-')) { lenIV = atoi(p + 7); } } @@ -120,7 +120,7 @@ set_cs_start(char *line) if (q) { r = cs_start; ++q; - while (!isspace(*q) && *q != '{') + while (!isspace((unsigned char)*q) && *q != '{') *r++ = *q++; *r = '\0'; } diff --git a/Build/source/utils/t1utils/t1utils-1.38/t1lib.c b/Build/source/utils/t1utils/t1utils-1.38/t1lib.c index 6b49a196561..f3e5fa7e245 100644 --- a/Build/source/utils/t1utils/t1utils-1.38/t1lib.c +++ b/Build/source/utils/t1utils/t1utils-1.38/t1lib.c @@ -59,7 +59,7 @@ translate_hex_string(char *s, char *saved_orphan) char *start = s; char *t = s; for (; *s; s++) { - if (isspace(*s)) + if (isspace((unsigned char)*s)) continue; if (c1) { *t++ = (hexval(c1) << 4) + hexval(*s); @@ -136,10 +136,10 @@ process_pfa(FILE *ifp, const char *ifp_filename, struct font_reader *fr) /* now that we have the line, handle it */ if (blocktyp == PFA_ASCII) { - if (strncmp(line, "currentfile eexec", 17) == 0 && isspace(line[17])) { + if (strncmp(line, "currentfile eexec", 17) == 0 && isspace((unsigned char)line[17])) { char saved_p; /* assert(line == buffer); */ - for (line += 18; isspace(*line); line++) + for (line += 18; isspace((unsigned char)*line); line++) /* nada */; saved_p = *line; *line = 0; @@ -158,12 +158,12 @@ process_pfa(FILE *ifp, const char *ifp_filename, struct font_reader *fr) if (blocktyp == PFA_EEXEC_TEST) { /* 8.Feb.2004: fix bug if first character in a binary eexec block is 0, reported by Werner Lemberg */ - for (; line < last && isspace(*line); line++) + for (; line < last && isspace((unsigned char)*line); line++) /* nada */; if (line == last) continue; - else if (last >= line + 4 && isxdigit(line[0]) && isxdigit(line[1]) - && isxdigit(line[2]) && isxdigit(line[3])) + else if (last >= line + 4 && isxdigit((unsigned char)line[0]) && isxdigit((unsigned char)line[1]) + && isxdigit((unsigned char)line[2]) && isxdigit((unsigned char)line[3])) blocktyp = PFA_HEX; else blocktyp = PFA_BINARY; diff --git a/Build/source/utils/t1utils/t1utils-1.38/t1mac.c b/Build/source/utils/t1utils/t1utils-1.38/t1mac.c index 007e5802a2f..9411a89a70d 100644 --- a/Build/source/utils/t1utils/t1utils-1.38/t1mac.c +++ b/Build/source/utils/t1utils/t1utils-1.38/t1mac.c @@ -370,10 +370,10 @@ t1mac_output_ascii(char *s, int len) s[len-1] = '\r'; t1mac_output_data((byte *)s, len); if (strncmp(s, "/FontName", 9) == 0) { - for (s += 9; isspace(*s); s++) ; + for (s += 9; isspace((unsigned char)*s); s++) ; if (*s == '/') { const char *t = ++s; - while (*t && !isspace(*t)) t++; + while (*t && !isspace((unsigned char)*t)) t++; free(font_name); font_name = (char *)malloc(t - s + 1); memcpy(font_name, s, t - s); @@ -992,11 +992,11 @@ particular purpose.\n"); int part = 0, len = 0; char *x, *s; for (x = s = font_name; *s; s++) - if (isupper(*s) || isdigit(*s)) { + if (isupper((unsigned char)*s) || isdigit((unsigned char)*s)) { *x++ = *s; part++; len = 1; - } else if (islower(*s)) { + } else if (islower((unsigned char)*s)) { if (len < (part <= 1 ? 5 : 3)) *x++ = *s; len++; -- cgit v1.2.3