aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog6
-rw-r--r--src/regex.c49
2 files changed, 29 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d21df41fe56..17dc673c681 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12004-12-05 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * regex.c (GET_UNSIGNED_NUMBER): Signal an error when reaching the end.
4 Remove redundant correctness checks.
5 (regex_compile): Fix up error codes for \{..\} expressions.
6
12004-12-05 Richard M. Stallman <rms@gnu.org> 72004-12-05 Richard M. Stallman <rms@gnu.org>
2 8
3 * regex.c (regex_compile): Fix end-of-pattern case for space. 9 * regex.c (regex_compile): Fix end-of-pattern case for space.
diff --git a/src/regex.c b/src/regex.c
index 130765134f5..1009c837dcf 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1950,28 +1950,27 @@ struct range_table_work_area
1950 1950
1951/* Get the next unsigned number in the uncompiled pattern. */ 1951/* Get the next unsigned number in the uncompiled pattern. */
1952#define GET_UNSIGNED_NUMBER(num) \ 1952#define GET_UNSIGNED_NUMBER(num) \
1953 do { if (p != pend) \ 1953 do { \
1954 { \ 1954 if (p == pend) \
1955 PATFETCH (c); \ 1955 FREE_STACK_RETURN (REG_EBRACE); \
1956 if (c == ' ') \ 1956 else \
1957 FREE_STACK_RETURN (REG_BADBR); \ 1957 { \
1958 while ('0' <= c && c <= '9') \ 1958 PATFETCH (c); \
1959 { \ 1959 while ('0' <= c && c <= '9') \
1960 int prev; \ 1960 { \
1961 if (num < 0) \ 1961 int prev; \
1962 num = 0; \ 1962 if (num < 0) \
1963 prev = num; \ 1963 num = 0; \
1964 num = num * 10 + c - '0'; \ 1964 prev = num; \
1965 if (num / 10 != prev) \ 1965 num = num * 10 + c - '0'; \
1966 FREE_STACK_RETURN (REG_BADBR); \ 1966 if (num / 10 != prev) \
1967 if (p == pend) \ 1967 FREE_STACK_RETURN (REG_BADBR); \
1968 break; \ 1968 if (p == pend) \
1969 PATFETCH (c); \ 1969 FREE_STACK_RETURN (REG_EBRACE); \
1970 } \ 1970 PATFETCH (c); \
1971 if (c == ' ') \ 1971 } \
1972 FREE_STACK_RETURN (REG_BADBR); \ 1972 } \
1973 } \ 1973 } while (0)
1974 } while (0)
1975 1974
1976#if ! WIDE_CHAR_SUPPORT 1975#if ! WIDE_CHAR_SUPPORT
1977 1976
@@ -3234,9 +3233,6 @@ regex_compile (pattern, size, syntax, bufp)
3234 3233
3235 beg_interval = p; 3234 beg_interval = p;
3236 3235
3237 if (p == pend)
3238 FREE_STACK_RETURN (REG_EBRACE);
3239
3240 GET_UNSIGNED_NUMBER (lower_bound); 3236 GET_UNSIGNED_NUMBER (lower_bound);
3241 3237
3242 if (c == ',') 3238 if (c == ',')
@@ -3253,7 +3249,8 @@ regex_compile (pattern, size, syntax, bufp)
3253 { 3249 {
3254 if (c != '\\') 3250 if (c != '\\')
3255 FREE_STACK_RETURN (REG_BADBR); 3251 FREE_STACK_RETURN (REG_BADBR);
3256 3252 if (p == pend)
3253 FREE_STACK_RETURN (REG_EESCAPE);
3257 PATFETCH (c); 3254 PATFETCH (c);
3258 } 3255 }
3259 3256