summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2013-05-10 16:22:40 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2013-05-10 16:22:40 +0000
commitbf2c63fda75cca4ab3006b6ccdf0f18fafe4fca5 (patch)
treedc09df2f741eab2608fe98a07226b2958d9626b9
parentdfc6711e21f6bcc4dcf9d78bdc26706959592646 (diff)
downloadpcre-bf2c63fda75cca4ab3006b6ccdf0f18fafe4fca5.tar.gz
Fix pcretest crash with a data line longer than 65536 bytes.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1327 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog2
-rw-r--r--pcretest.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ae04c6..a24c186 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -156,6 +156,8 @@ Version 8.33 28-April-2013
41. Applied a user patch to fix a number of spelling mistakes in comments.
+42. Data lines longer than 65536 caused pcretest to crash.
+
Version 8.32 30-November-2012
-----------------------------
diff --git a/pcretest.c b/pcretest.c
index 6ef3252..25f3853 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -4411,7 +4411,8 @@ while (!done)
#ifndef NOUTF
/* Check that the data is well-formed UTF-8 if we're in UTF mode. To create
- invalid input to pcre_exec, you must use \x?? or \x{} sequences. */
+ invalid input to pcre_exec, you must use \x?? or \x{} sequences. */
+
if (use_utf)
{
pcre_uint8 *q;
@@ -4429,21 +4430,23 @@ while (!done)
#ifdef SUPPORT_VALGRIND
/* Mark the dbuffer as addressable but undefined again. */
+
if (dbuffer != NULL)
{
VALGRIND_MAKE_MEM_UNDEFINED(dbuffer, dbuffer_size * CHAR_SIZE);
}
#endif
- /* Allocate a buffer to hold the data line. len+1 is an upper bound on
- the number of pcre_uchar units that will be needed. */
- if (dbuffer == NULL || (size_t)len >= dbuffer_size)
+ /* Allocate a buffer to hold the data line; len+1 is an upper bound on
+ the number of pcre_uchar units that will be needed. */
+
+ while (dbuffer == NULL || (size_t)len >= dbuffer_size)
{
dbuffer_size *= 2;
dbuffer = (pcre_uint8 *)realloc(dbuffer, dbuffer_size * CHAR_SIZE);
if (dbuffer == NULL)
{
- fprintf(stderr, "pcretest: malloc(%d) failed\n", (int)dbuffer_size);
+ fprintf(stderr, "pcretest: realloc(%d) failed\n", (int)dbuffer_size);
exit(1);
}
}