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/makeindexk/ChangeLog | 5 +++++ Build/source/texk/makeindexk/genind.c | 4 ++-- Build/source/texk/makeindexk/scanid.c | 10 +++++----- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'Build/source/texk/makeindexk') 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"; -- cgit v1.2.3