------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1134
           Summary: pcre_fullinfo gives incorrect info for
                    PCRE_INFO_STUDYSIZE
           Product: PCRE
           Version: 8.12
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


pcre_study uses malloc to get a single block of data to contain both a
pcre_extra block and a pcre_study_data block. The length of the pcre_study_data
block is stored within it.

This data is returned to the calling application and thereafter used as the
"extra" parameter. Its structure is unknown to the caller but pcre_fullinfo can
be used to obtain its size (so that it can be copied, for example). However,
the length given is that stored in the pcre_study_data block - that is, it is
short by sizeof (pcre_extra).

As the length field exists only for the benefit of pcre_fullinfo, the following
change fixes the problem (revision number is per my own SVN repository):

Index: pcre_study.c
===================================================================
--- pcre_study.c        (revision 10122)
+++ pcre_study.c        (working copy)
@@ -1108,7 +1108,7 @@
 extra->flags = PCRE_EXTRA_STUDY_DATA;
 extra->study_data = study;

-study->size = sizeof(pcre_study_data);
+study->size = sizeof(pcre_extra) + sizeof(pcre_study_data);
 study->flags = 0;

 if (bits_set)


-- 
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email

-- 
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to