[pcre-dev] [Bug 979] New: Stack overflow in libpcre - segmen…

Top Page
Delete this message
Author: Kevin Caunt
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 979] New: Stack overflow in libpcre - 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=979
           Summary: Stack overflow in libpcre - segmentation fault
           Product: PCRE
           Version: 7.8
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: krc@???
                CC: pcre-dev@???



I have a small test program that causes a stack overflow and a segmentation
fault

The test program causes a recursion problem in the Match() function in the
pcre_exec code.
If I --disable-stack-for-recursion the program runs

====================================================
#include <pcre.h>
#include <string.h>
#include <stdio.h>

#define SAVESIZE 50


#define SUBJECT_SIZE 18000


int main (int argc, char **argv)
{

    char subject[SUBJECT_SIZE+1];
    memset(subject,'A',SUBJECT_SIZE);
    subject[SUBJECT_SIZE]='\0';


    const char* pattern="(A)*";


    const char* error;
    int offset;


    real_pcre *re = pcre_compile(pattern, 0, &error, &offset, NULL);


    int offsets[SAVESIZE];


    int rc = pcre_exec(re,NULL,subject,SUBJECT_SIZE,0,0,offsets,SAVESIZE);


    printf("%d\n",rc);
}
=========================================================



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