Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:wenbowang
grep
grep-2.6.3-dfa-heap-overrun-fix.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grep-2.6.3-dfa-heap-overrun-fix.patch of Package grep
diff --git a/src/dfa.c b/src/dfa.c --- a/src/dfa.c +++ b/src/dfa.c @@ -2134,7 +2134,7 @@ dfaanalyze (struct dfa *d, int searchflag) MALLOC(lastpos, position, d->nleaves); o_lastpos = lastpos, lastpos += d->nleaves; CALLOC(nalloc, int, d->tindex); - MALLOC(merged.elems, position, d->nleaves); + MALLOC(merged.elems, position, 2 * d->nleaves); CALLOC(d->follows, position_set, d->tindex); diff --git a/tests/Makefile.am b/tests/Makefile.am --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,7 @@ TESTS = \ case-fold-char-range \ case-fold-char-type \ char-class-multibyte \ + dfa-heap-overrun \ dfaexec-multibyte \ empty \ epipe \ diff --git a/tests/Makefile.in b/tests/Makefile.in --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -799,6 +799,7 @@ TESTS = \ case-fold-char-range \ case-fold-char-type \ char-class-multibyte \ + dfa-heap-overrun \ dfaexec-multibyte \ empty \ epipe \ @@ -1192,6 +1192,8 @@ dfaexec-multibyte.log: dfaexec-multibyte @p='dfaexec-multibyte'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) empty.log: empty @p='empty'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +dfa-heap-overrun.log: dfa-heap-overrun + @p='dfa-heap-overrun'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) epipe.log: epipe @p='epipe'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) ere.sh.log: ere.sh diff --git a/tests/dfa-heap-overrun b/tests/dfa-heap-overrun new file mode 100755 --- a/dev/null +++ b/tests/dfa-heap-overrun @@ -0,0 +1,26 @@ +#!/bin/sh +# Trigger a heap overrun in grep-2.6..grep-2.8. + +# Copyright (C) 2011 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +grep -E '(^| )*(a|b)*(c|d)*( |$)' < /dev/null +test $? = 1 || fail=1 + +Exit $fail -- cgit v0.9.0.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor