From 31f00f0d66343cd8540a6fb336e25d505a98c4f1 Mon Sep 17 00:00:00 2001 From: ph10 Date: Tue, 3 Feb 2015 17:08:54 +0000 Subject: Fix pcretest crash with /g and zero-length ovector. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1515 2f5784b3-3f2a-0410-8824-cb99058d5e15 --- ChangeLog | 3 +++ pcretest.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 72bb80a..d962488 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ Version 8.37 xx-xxx-201x 3. If a pattern in pcretest input had the P (POSIX) modifier followed by an unrecognized modifier, a crash could occur. + +4. An attempt to do global matching in pcretest with a zero-length ovector + caused a crash. diff --git a/pcretest.c b/pcretest.c index 2dc2061..e28f897 100644 --- a/pcretest.c +++ b/pcretest.c @@ -5603,6 +5603,12 @@ while (!done) /* If not /g or /G we are done */ if (!do_g && !do_G) break; + + if (use_offsets == NULL) + { + fprintf(outfile, "Cannot do global matching without an ovector\n"); + break; + } /* If we have matched an empty string, first check to see if we are at the end of the subject. If so, the /g loop is over. Otherwise, mimic what -- cgit v1.2.1