[pcre-dev] [Bug 1370] New: Combined graphemes in UTF8 may ca…

Top Page
Delete this message
Author: Patrik Nyblom
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1370] New: Combined graphemes in UTF8 may cause segmentation fault
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1370
           Summary: Combined graphemes in UTF8 may cause segmentation fault
           Product: PCRE
           Version: 8.33
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: high
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: bufflig@???
         QAContact: bufflig@???
                CC: pcre-dev@???



Created an attachment (id=642)
--> (http://bugs.exim.org/attachment.cgi?id=642)
Program to provoke the crash and dirty fix diff

The PCRE library (8.33) was built with
$ ./configure --enable-utf --enable-unicode-properties --disable-shared
--disable-stack-for-recursion
$ make

A program with a subject containing combined graphemes (like an 'A' followed by
a combining diacritical mark, UCD_CATEGORY ucp_M) may cause the eptr to back of
to positions prior to the actual subject and eventually cause a segmentation
fault.

The problem *shows up* in pcre_exec.c:5684 and the loop below. A quick fix
returning MATCH_NOMATCH if eptr moves back before md->start_subject removes the
crash, but I am not sure if this is the semantically correct fix.

I've attached a tar.gz file with a diff for my dirty fix, just to point out
where the error occurs, as well as a test program (a stripped down version of
pcredemo.c, which places some garbage before the actual subject to provoke the
crash). The test program dumps core on my 64bit Linux.

I found the error while integrating PCRE 8.33 into the next version of
Erlang/OTP, as I by mistake run test number 10 on the regular machine instead
of the DFA ditto.

Please see attached files for details.

Best regards,
Patrik Nyblom, Erlang/OTP


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