1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Description: fix regex stack overflow
this only caused an FTBFS due to a testsuite failure on alpha
but overwrote the stack on any architecture
Author: mirabilos <tg@debian.org>
Applied-Upstream: yes
--- a/libregex/rx.c
+++ b/libregex/rx.c
@@ -344,11 +344,11 @@ static int matchpiece(void*__restrict__
unsigned int *offsets;
assert(a->max>0 && a->max<1000);
#ifdef DEBUG
- printf("alloca(%d)\n",sizeof(int)*a->max);
+ printf("alloca(%d)\n",sizeof(int)*(a->max+1));
#endif
- offsets=alloca(sizeof(int)*a->max);
+ offsets=alloca(sizeof(int)*(a->max+1));
offsets[0]=0;
-// printf("allocating %d offsets...\n",a->max);
+// printf("allocating %d offsets...\n",a->max+1);
// printf("matchpiece \"%s\"...\n",s);
/* first, try to match the atom as often as possible, up to a->max times */
if (a->max == 1 && a->min == 1)
|