diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-19 11:43:52 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-19 11:43:52 +0000 |
commit | dfa496b51809b9404ee4f2dde02291745837b53f (patch) | |
tree | 5d9bd3bd74d348164f50b2ed9a5878fcfac8b743 /Build/source | |
parent | e5b8a1a0369901d3d73384cf553619d9351679aa (diff) |
pdfTeX, LuaTeX: Avoid undefined behaviour when char is signed
git-svn-id: svn://tug.org/texlive/trunk@34311 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog | 2 | ||||
-rw-r--r-- | Build/source/texk/psutils/psutils-1.23-PATCHES/patch-30-unsigned (renamed from Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned) | 0 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/mapfile.w | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/tounicode.w | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/writet1.w | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/font/writettf.w | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lang/texlang.w | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/pdf/pdfgen.w | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/mapfile.c | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/tounicode.c | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/writet1.c | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/writettf.c | 2 |
14 files changed, 33 insertions, 22 deletions
diff --git a/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog b/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog index c00f0d6efa7..7cab60f9ce3 100644 --- a/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog +++ b/Build/source/texk/psutils/psutils-1.23-PATCHES/ChangeLog @@ -1,6 +1,6 @@ 2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de> - * patch-02-unsigned (new): Avoid undefined behaviour. + * patch-30-unsigned (new): Avoid undefined behaviour. 2014-01-16 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned b/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-30-unsigned index 97d13b3c290..97d13b3c290 100644 --- a/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-02-unsigned +++ b/Build/source/texk/psutils/psutils-1.23-PATCHES/patch-30-unsigned diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 845a1dd3ed2..b59cc04370c 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,9 @@ +2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de> + + * font/mapfile.w, font/tounicode.w, font/writet1.w, + font/writettf.w, lang/texlang.w, pdf/pdfgen.w: Avoid undefined + behaviour when char is signed. + 2014-06-02 Peter Breitenlohner <peb@mppmu.mpg.de> * lua/luatex-api.h: Use '#define LUAI_HASHLIMIT 5' as default, diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.w b/Build/source/texk/web2c/luatexdir/font/mapfile.w index 24c8855509e..ff52ac5e6cc 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.w +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.w @@ -366,15 +366,15 @@ static void fm_scan_line(void) fm = new_fm_entry(); read_field(r, q, buf); set_field(tfm_name); - if (!isdigit(*r)) { /* 2nd field ps_name may not start with a digit */ + if (!isdigit((unsigned char)*r)) { /* 2nd field ps_name may not start with a digit */ read_field(r, q, buf); set_field(ps_name); } - if (isdigit(*r)) { /* font descriptor /Flags given? */ - for (s = r; isdigit(*s); s++); + if (isdigit((unsigned char)*r)) { /* font descriptor /Flags given? */ + for (s = r; isdigit((unsigned char)*s); s++); if (*s == ' ' || *s == '"' || *s == '<' || *s == '\0') { /* not e. g. 8r.enc */ fm->fd_flags = atoi(r); - while (isdigit(*r)) + while (isdigit((unsigned char)*r)) r++; } } diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.w b/Build/source/texk/web2c/luatexdir/font/tounicode.w index b33bef027a0..1ed589eb1ce 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.w +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.w @@ -92,7 +92,7 @@ void def_tounicode(str_number glyph, str_number unistr) for (i = 0; i < l; i++) { if (p[i] == ' ') valid_unistr = 2; /* if a space occurs we treat this entry as a string */ - else if (!isXdigit(p[i])) { + else if (!isXdigit((unsigned char)p[i])) { valid_unistr = 0; break; } @@ -151,7 +151,7 @@ static long check_unicode_value(char *s, boolean multiple_value) return UNI_UNDEF; for (i = 0; i < l; i++) { - if (!isXdigit(s[i])) + if (!isXdigit((unsigned char)s[i])) return UNI_UNDEF; if (multiple_value) { if (i % 4 == 3) { diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w index 2e65017d2f8..036c65ad9c3 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.w +++ b/Build/source/texk/web2c/luatexdir/font/writet1.w @@ -456,7 +456,7 @@ static float t1_scan_num(char *p, char **r) luatex_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; } @@ -1522,7 +1522,7 @@ static void t1_flush_cs(PDF pdf, 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/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w index 2cab4b2371c..169e1c20d81 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.w +++ b/Build/source/texk/web2c/luatexdir/font/writettf.w @@ -622,7 +622,7 @@ static char *strip_spaces_and_delims(char *s, int l) for (i = 0; i < l; s++, i++) { if (*s == '(' || *s == ')' || *s == '<' || *s == '>' || *s == '[' || *s == ']' || *s == '{' || *s == '}' || - *s == '/' || *s == '%' || isspace(*s)) + *s == '/' || *s == '%' || isspace((unsigned char)*s)) continue; *p++ = *s; } diff --git a/Build/source/texk/web2c/luatexdir/lang/texlang.w b/Build/source/texk/web2c/luatexdir/lang/texlang.w index 9ffe9f546a9..97d9f00c682 100644 --- a/Build/source/texk/web2c/luatexdir/lang/texlang.w +++ b/Build/source/texk/web2c/luatexdir/lang/texlang.w @@ -193,7 +193,7 @@ const char *clean_hyphenation(const char *buff, char **cleaned) char *uindex = (char *)word; const char *s = buff; - while (*s && !isspace(*s)) { + while (*s && !isspace((unsigned char)*s)) { word[i++] = (unsigned)*s; s++; if ((s-buff)>MAX_WORD_LEN) { @@ -271,7 +271,7 @@ void load_hyphenation(struct tex_language *lang, const unsigned char *buff) lua_rawgeti(L, LUA_REGISTRYINDEX, lang->exceptions); s = (const char *) buff; while (*s) { - while (isspace(*s)) + while (isspace((unsigned char)*s)) s++; if (*s) { value = s; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index 0f312f2c781..78873c7b5d5 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -616,7 +616,7 @@ void pdf_print_str(PDF pdf, const char *s) return; } s++; - while (is_hex_char(*s)) + while (is_hex_char((unsigned char)*s)) s++; if (s != orig + l) { pdf_out(pdf, '('); diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index ac596ca5337..29489fa6d2f 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Peter Breitenlohner <peb@mppmu.mpg.de> + + * mapfile.c, tounicode.c, writet1.c, writettf: Avoid undefined + behaviour when char is signed. + 2014-06-18 Peter Breitenlohner <peb@mppmu.mpg.de> * ttf2afm.c: Avoid undefined behaviour when char is signed. diff --git a/Build/source/texk/web2c/pdftexdir/mapfile.c b/Build/source/texk/web2c/pdftexdir/mapfile.c index 3efe7a71e90..c0e91bf839b 100644 --- a/Build/source/texk/web2c/pdftexdir/mapfile.c +++ b/Build/source/texk/web2c/pdftexdir/mapfile.c @@ -428,15 +428,15 @@ static void fm_scan_line(void) fm = new_fm_entry(); read_field(r, q, buf); set_field(tfm_name); - if (!isdigit(*r)) { /* 2nd field ps_name may not start with a digit */ + if (!isdigit((unsigned char)*r)) { /* 2nd field ps_name may not start with a digit */ read_field(r, q, buf); set_field(ps_name); } - if (isdigit(*r)) { /* font descriptor /Flags given? */ - for (s = r; isdigit(*s); s++); + if (isdigit((unsigned char)*r)) { /* font descriptor /Flags given? */ + for (s = r; isdigit((unsigned char)*s); s++); if (*s == ' ' || *s == '"' || *s == '<' || *s == '\0') { /* not e. g. 8r.enc */ fm->fd_flags = atoi(r); - while (isdigit(*r)) + while (isdigit((unsigned char)*r)) r++; } } diff --git a/Build/source/texk/web2c/pdftexdir/tounicode.c b/Build/source/texk/web2c/pdftexdir/tounicode.c index 31121d864e1..a246366bf03 100644 --- a/Build/source/texk/web2c/pdftexdir/tounicode.c +++ b/Build/source/texk/web2c/pdftexdir/tounicode.c @@ -80,7 +80,7 @@ void deftounicode(strnumber glyph, strnumber unistr) for (i = 0; i < l; i++) { if (p[i] == ' ') valid_unistr = 2; /* if a space occurs we treat this entry as a string */ - else if (!isXdigit(p[i])) { + else if (!isXdigit((unsigned char)p[i])) { valid_unistr = 0; break; } @@ -137,7 +137,7 @@ static long check_unicode_value(const char *s, boolean multiple_value) return UNI_UNDEF; for (i = 0; i < l; i++) { - if (!isXdigit(s[i])) + if (!isXdigit((unsigned char)s[i])) return UNI_UNDEF; if (multiple_value) { if (i % 4 == 3) { diff --git a/Build/source/texk/web2c/pdftexdir/writet1.c b/Build/source/texk/web2c/pdftexdir/writet1.c index 0e39aaa209c..363853bf38a 100644 --- a/Build/source/texk/web2c/pdftexdir/writet1.c +++ b/Build/source/texk/web2c/pdftexdir/writet1.c @@ -379,7 +379,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; } @@ -1493,7 +1493,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/web2c/pdftexdir/writettf.c b/Build/source/texk/web2c/pdftexdir/writettf.c index 0ec53a9a210..ab68813a3c9 100644 --- a/Build/source/texk/web2c/pdftexdir/writettf.c +++ b/Build/source/texk/web2c/pdftexdir/writettf.c @@ -328,7 +328,7 @@ static char *strip_spaces_and_delims(char *s, int l) for (i = 0; i < l; s++, i++) { if (*s == '(' || *s == ')' || *s == '<' || *s == '>' || *s == '[' || *s == ']' || *s == '{' || *s == '}' || - *s == '/' || *s == '%' || isspace(*s)) + *s == '/' || *s == '%' || isspace((unsigned char)*s)) continue; *p++ = *s; } |