Mercurial > emacs
comparison src/regex.c @ 21963:b717a61747c5
(regex_compile): When checking after exactn
for a repetition operator, don't look beyond end of pattern arg.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 06 May 1998 20:46:35 +0000 |
parents | 1d93b782b983 |
children | 566c88b62de6 |
comparison
equal
deleted
inserted
replaced
21962:c452f82d8d45 | 21963:b717a61747c5 |
---|---|
1 /* Extended regular expression matching and search library, version | 1 /* Extended regular expression matching and search library, version |
2 0.12. (Implements POSIX draft P10003.2/D11.2, except for | 2 0.12. (Implements POSIX draft P10003.2/D11.2, except for |
3 internationalization features.) | 3 internationalization features.) |
4 | 4 |
5 Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 5 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 2, or (at your option) | 9 the Free Software Foundation; either version 2, or (at your option) |
10 any later version. | 10 any later version. |
2905 | 2905 |
2906 /* We have only one byte following the exactn for the count. */ | 2906 /* We have only one byte following the exactn for the count. */ |
2907 || *pending_exact >= (1 << BYTEWIDTH) - (p - p1) | 2907 || *pending_exact >= (1 << BYTEWIDTH) - (p - p1) |
2908 | 2908 |
2909 /* If followed by a repetition operator. */ | 2909 /* If followed by a repetition operator. */ |
2910 || *p == '*' || *p == '^' | 2910 || (p != pend && (*p == '*' || *p == '^')) |
2911 || ((syntax & RE_BK_PLUS_QM) | 2911 || ((syntax & RE_BK_PLUS_QM) |
2912 ? *p == '\\' && (p[1] == '+' || p[1] == '?') | 2912 ? p + 1 < pend && *p == '\\' && (p[1] == '+' || p[1] == '?') |
2913 : (*p == '+' || *p == '?')) | 2913 : p != pend && (*p == '+' || *p == '?')) |
2914 || ((syntax & RE_INTERVALS) | 2914 || ((syntax & RE_INTERVALS) |
2915 && ((syntax & RE_NO_BK_BRACES) | 2915 && ((syntax & RE_NO_BK_BRACES) |
2916 ? *p == '{' | 2916 ? p != pend && *p == '{' |
2917 : (p[0] == '\\' && p[1] == '{')))) | 2917 : p + 1 < pend && p[0] == '\\' && p[1] == '{'))) |
2918 { | 2918 { |
2919 /* Start building a new exactn. */ | 2919 /* Start building a new exactn. */ |
2920 | 2920 |
2921 laststart = b; | 2921 laststart = b; |
2922 | 2922 |