diff options
author | dgp <dgp@users.sourceforge.net> | 2013-04-11 13:35:41 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-04-11 13:35:41 (GMT) |
commit | 236381c05a24d18a62fdd7a08931df13db530548 (patch) | |
tree | eaab699098f38e511287339442034a23b50a0306 | |
parent | 2bcd186571b8f37c820add859b48f7046260d261 (diff) | |
parent | 0af5420032e18a434670faed6ce8a932fc1a5b28 (diff) | |
download | tcl-236381c05a24d18a62fdd7a08931df13db530548.zip tcl-236381c05a24d18a62fdd7a08931df13db530548.tar.gz tcl-236381c05a24d18a62fdd7a08931df13db530548.tar.bz2 |
merge trunk
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/regc_color.c | 7 | ||||
-rw-r--r-- | generic/regerrs.h | 1 | ||||
-rw-r--r-- | generic/regex.h | 1 | ||||
-rw-r--r-- | generic/regguts.h | 1 | ||||
-rw-r--r-- | tests/regexp.test | 11 | ||||
-rw-r--r-- | win/Makefile.in | 2 |
7 files changed, 30 insertions, 1 deletions
@@ -1,3 +1,11 @@ +2013-04-08 Don Porter <dgp@users.sourceforge.net> + + * generic/regc_color.c: [Bug 3610026] Stop crash when the number of + * generic/regerrs.h: "colors" in a regular expression overflows + * generic/regex.h: a short int. Thanks to Heikki Linnakangas + * generic/regguts.h: for the report and the patch. + * tests/regexp.test: + 2013-04-04 Reinhard Max <max@suse.de> * library/http/http.tcl (http::geturl): Allow URLs that don't have diff --git a/generic/regc_color.c b/generic/regc_color.c index b7a571c..f5d6dfd 100644 --- a/generic/regc_color.c +++ b/generic/regc_color.c @@ -254,7 +254,14 @@ newcolor( * Oops, must allocate more. */ + if (cm->max == MAX_COLOR) { + CERR(REG_ECOLORS); + return COLORLESS; /* too many colors */ + } n = cm->ncds * 2; + if (n < MAX_COLOR + 1) { + n = MAX_COLOR + 1; + } if (cm->cd == cm->cdspace) { newCd = (struct colordesc *) MALLOC(n * sizeof(struct colordesc)); if (newCd != NULL) { diff --git a/generic/regerrs.h b/generic/regerrs.h index 259c0cb..72548ff 100644 --- a/generic/regerrs.h +++ b/generic/regerrs.h @@ -17,3 +17,4 @@ { REG_MIXED, "REG_MIXED", "character widths of regex and string differ" }, { REG_BADOPT, "REG_BADOPT", "invalid embedded option" }, { REG_ETOOBIG, "REG_ETOOBIG", "nfa has too many states" }, +{ REG_ECOLORS, "REG_ECOLORS", "too many colors" }, diff --git a/generic/regex.h b/generic/regex.h index d6d46ce..9466fbb 100644 --- a/generic/regex.h +++ b/generic/regex.h @@ -281,6 +281,7 @@ typedef struct { #define REG_MIXED 17 /* character widths of regex and string differ */ #define REG_BADOPT 18 /* invalid embedded option */ #define REG_ETOOBIG 19 /* nfa has too many states */ +#define REG_ECOLORS 20 /* too many colors */ /* two specials for debugging and testing */ #define REG_ATOI 101 /* convert error-code name to number */ #define REG_ITOA 102 /* convert error-code number to name */ diff --git a/generic/regguts.h b/generic/regguts.h index 67f9625..b4944dc 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -145,6 +145,7 @@ typedef short color; /* colors of characters */ typedef int pcolor; /* what color promotes to */ +#define MAX_COLOR SHRT_MAX /* max color value */ #define COLORLESS (-1) /* impossible color */ #define WHITE 0 /* default color, parent of all others */ diff --git a/tests/regexp.test b/tests/regexp.test index 2d2814a..1c30001 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -865,6 +865,17 @@ test regexp-22.4 {Bug 3606139} -setup { } -cleanup { rename a {} } -returnCodes 1 -result {couldn't compile regular expression pattern: nfa has too many states} +test regexp-22.5 {Bug 3610026} -setup { + set e {} + set cp 99 + while {$cp < 32864} { + append e [format %c [incr cp]] + } +} -body { + regexp -about $e +} -cleanup { + unset -nocomplain e cp +} -returnCodes error -match glob -result {*too many colors*} test regexp-23.1 {regexp -all and -line} { set string "" diff --git a/win/Makefile.in b/win/Makefile.in index bfc4e0d..6f5211e 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -640,7 +640,7 @@ install-libraries: libraries install-tzdata install-msgs $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ done; @echo "Installing package http 2.8.7 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl7/8.6/http-2.8.7.tm; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.7.tm; @echo "Installing library opt0.4 directory"; @for j in $(ROOT_DIR)/library/opt/*.tcl; \ do \ |