This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
There is no adequate test case for this, and I haven't
been able to come up with one yet... The case in question
is when EXTEND_BUFFER's call to realloc returns the input
pointer.
This one works in gawk whereas the other one failed.
(It's still cleaner than the original, and now it works too. 8^)
OK?
2000-08-03 Greg McGary <greg@mcgary.org>
* posix/regex.c (SET_HIGH_BOUND): New macro.
(MOVE_BUFFER_POINTER): Use it.
(ELSE_EXTEND_BUFFER_HIGH_BOUND): New macro.
(EXTEND_BUFFER): Use it.
Index: posix/regex.c
===================================================================
RCS file: /cvs/glibc/libc/posix/regex.c,v
retrieving revision 1.79
diff -u -p -r1.79 regex.c
--- regex.c 2000/08/03 20:05:18 1.79
+++ regex.c 2000/08/03 21:53:57
@@ -1748,11 +1748,24 @@ static reg_errcode_t compile_range _RE_A
correct places in the new one. If extending the buffer results in it
being larger than MAX_BUF_SIZE, then flag memory exhausted. */
#if __BOUNDED_POINTERS__
+# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
# define MOVE_BUFFER_POINTER(P) \
- (__ptrhigh (P) = (__ptrlow (P) += incr) + bufp->allocated, \
- __ptrvalue (P) += incr)
+ (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
+# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
+ else \
+ { \
+ SET_HIGH_BOUND (b); \
+ SET_HIGH_BOUND (begalt); \
+ if (fixup_alt_jump) \
+ SET_HIGH_BOUND (fixup_alt_jump); \
+ if (laststart) \
+ SET_HIGH_BOUND (laststart); \
+ if (pending_exact) \
+ SET_HIGH_BOUND (pending_exact); \
+ }
#else
# define MOVE_BUFFER_POINTER(P) (P) += incr
+# define ELSE_EXTEND_BUFFER_HIGH_BOUND
#endif
#define EXTEND_BUFFER() \
do { \
@@ -1778,6 +1791,7 @@ static reg_errcode_t compile_range _RE_A
if (pending_exact) \
MOVE_BUFFER_POINTER (pending_exact); \
} \
+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
} while (0)
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |