diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-02-10 23:44:36 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-02-10 23:46:12 -0800 |
commit | fbc60d437bcaa586801441677bb1dccc1f7077d8 (patch) | |
tree | c66596c9f81d4dcb7e3868262ca73c7c967c3084 /tests/pcre-jitstack | |
parent | 846e7eee8bdc84b332150043a66fe8f17dc1a30b (diff) | |
download | grep-fbc60d437bcaa586801441677bb1dccc1f7077d8.tar.gz |
Grow the JIT stack if it becomes exhausted
Problem reported by Oliver Freyermuth in: http://bugs.gnu.org/19833
* NEWS: Document the fix.
* tests/Makefile.am (TESTS): Add pcre-jitstack.
* tests/pcre-jitstack: New file.
* src/pcresearch.c (NSUB): Move decl earlier, since it's needed
earlier now.
(jit_stack_size) [PCRE_STUDY_JIT_COMPILE]: New static var.
(jit_exec): New function.
(Pcompile): Initialize jit_stack_size.
(Pexecute): Use new jit_exec function. Report a useful diagnostic
if the error is PCRE_ERROR_JIT_STACKLIMIT.
Diffstat (limited to 'tests/pcre-jitstack')
-rwxr-xr-x | tests/pcre-jitstack | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/pcre-jitstack b/tests/pcre-jitstack new file mode 100755 index 00000000..03587f1a --- /dev/null +++ b/tests/pcre-jitstack @@ -0,0 +1,39 @@ +#! /bin/sh +# Grep 2.21 would report "grep: internal PCRE error: -27" +# +# Copyright 2015 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +require_pcre_ + +nl_base64=$(echo | (base64) 2>/dev/null) && test "X$nl_base64" = XCg== || + skip_ "your system lacks the base64 program" +foo=$( (echo foo | gzip | gzip -d) 2>/dev/null) && test "X$foo" = Xfoo || + skip_ "your system lacks the gzip program" + +fail=0 + +base64 -d >pcrejit.txt.gz <<'EOF' +H4sIAAAAAAACA+2bUU4DMQxE/7mMz5T7XwKE+IBKVLue58yk0B9EtX6xJxN7t4VaH69a6+tHrW+/ +r4e3n75KARWShSOFTtiumE3FPVyo79ATIJ0Ry0No/yXe99UIUqTGKKUzYHFJHJoaCONQDCnDSCDS +IPAvGCVeXNsZ7lpbWFfdaZtgPos5LeK2C1TBKzD09V3HFlCOsbFT/hNbz4HzJaRjnjdam9FXw/o6 +VyPozhMmiaRYAMeNSJR1iMjBEFLMtsH7lptartfxkzPQgFVofwRlxKsMYn2KNDnU9fsOQCkRIYVT +G80ZRqBpSQjRYPX7s9gvtqknyNE2f8V09sxHM7YPmMMJgrmVna2AT717n5fUAIDkiBCqFgWUUgKD +8jOc0Rgj5JS6vZnQI14wkaTDAkD266p/iVHs8gjCrMFARVM0iEVgFAa9YRAQT4tkgsmloTJLmyCm +uSHRnTkzIdZMmZ5kYX/iJFtTwu9cFvr3aDWcUx4pUW/cVQwPoQSlwguNd4M0vTpAauKodmLFXv1P +dkcKkYUglER2Q4L4gnmOiNGzSBATwGQgwihs5/QffIhyfg4hJvM2r4Rp6L+1ibCCd4jYZ6jCiBlc +2+y4fl4yTGIwcWXNAUEeXmu8iCMV96DNTnmRNICDk2N5qaXGbsF91OX/0hlcYTjrMfy02p9Xv70D +mv3RZCFOAAA= +EOF +test $? -eq 0 || framework_failure_ + +gzip -d pcrejit.txt || framework_failure_ + +LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt +test $? -eq 1 || fail=1 + +Exit $fail |