Revision: 1024
http://vcs.pcre.org/viewvc?view=rev&revision=1024
Author: ph10
Date: 2012-08-29 12:08:24 +0100 (Wed, 29 Aug 2012)
Log Message:
-----------
Fix re_nsub bug in the POSIX wrapper.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcreposix.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2012-08-29 10:13:55 UTC (rev 1023)
+++ code/trunk/ChangeLog 2012-08-29 11:08:24 UTC (rev 1024)
@@ -58,8 +58,12 @@
12. Added support for PCRE_STUDY_EXTRA_NEEDED.
+13. In the POSIX wrapper regcomp() function, setting re_nsub field in the preg
+ structure could go wrong in environments where size_t is not the same size
+ as int.
+
Version 8.31 06-July-2012
-------------------------
Modified: code/trunk/pcreposix.c
===================================================================
--- code/trunk/pcreposix.c 2012-08-29 10:13:55 UTC (rev 1023)
+++ code/trunk/pcreposix.c 2012-08-29 11:08:24 UTC (rev 1024)
@@ -259,6 +259,7 @@
int erroffset;
int errorcode;
int options = 0;
+int re_nsub = 0;
if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
@@ -282,7 +283,8 @@
}
(void)pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT,
- &(preg->re_nsub));
+ &re_nsub);
+preg->re_nsub = (size_t)re_nsub;
return 0;
}