Hi,
When I used the pattern "((.|\n)+)" to match a huge buffer which size was
about 32Kbytes, I got a segmentation fault. Is it a bug? My pcre version is
8.10 and I ran "./configure" to generate Makefile. The following is my test
program.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "pcre.h"
#define SRC_STR_LEN (4096 * 32)
char src_str[SRC_STR_LEN];
int pcre_test_func(int argc, char *argv[])
{
pcre *expression;
char *pattern = "((.|\n)+)";
int ovector[300] = {0};
const char *err;
int err_offset;
int i = 0;
for(i=0; i< SRC_STR_LEN; i++) {
src_str[i] = 'a';
}
expression = pcre_compile(pattern, 0, &err, &err_offset, NULL);
if (expression == NULL) {
printf("pcre_compile failed.\n");
return -1;
}
ovector[0] = -1;
ovector[1] = 0;
printf("%s: %d\n", __FUNCTION__, __LINE__);
pcre_exec(expression, NULL, src_str, SRC_STR_LEN, 0, 0, ovector,
300);
printf("%s: %d\n", __FUNCTION__, __LINE__);
pcre_free(expression);
return 0;
}
int main(int argc,char *argv[])
{
pcre_test_func(argc, argv);
return 0;
}