[pcre-dev] [Bug 1562] New: intermittent segfault using grep …

Página Inicial
Delete this message
Autor: J P Hendrix
Data:  
Para: pcre-dev
Novos Tópicos: [pcre-dev] [Bug 1562] intermittent segfault using grep -P
Assunto: [pcre-dev] [Bug 1562] New: intermittent segfault using grep -P
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1562
           Summary: intermittent segfault using grep -P
           Product: PCRE
           Version: 8.36
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: bugs.exim.org@???
                CC: pcre-dev@???



This bug was previously discussed with the gnu grep project and we concluded
that it is really an issue with pcre. Although I initially found the problem
with grep, Norihiro Tanaka from the gnu grep project managed to reproduce it
using only pcre-8.36 (Fedora21, RHEL 6.5). His findings are subsequently
reproduced by Paul Eggert (gnu grep; CentOS 6.5 x86-64) and myself (Ubuntu
14.04 x64_64).

Notes from Norihiro: By the way, if we enabled to optimize or recompile pcre
with --enable-jit option, it did not reproduced.

How to reproduce:

== Norihiro's code ==
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pcre.h>

enum { LEN = 15000 };
enum { NSUB = 300 };

int
main ()
{
char *text = malloc ((LEN + 1) * sizeof *text);
memset (text, '0', LEN);
text[LEN] = '\0';
char const *re = "0(?:(?!foo).)+";
char const *ep;
int eo;

  pcre *cre = pcre_compile (re, 0, &ep, &eo, NULL);
  if (!cre)
    exit (EXIT_FAILURE);


int sub[NSUB];
pcre_exec (cre, NULL, text, strlen (text), 0, 0, sub, NSUB);

exit (EXIT_SUCCESS);
}
==

Steps I followed to reproduce:

€ tar xzf pcre-8.36.tar.gz
€ cd pcre-8.36
€ CFLAGS=-g ./configure --enable-utf --enable-unicode-properties
--prefix=/tmp/segfaultGrep
€ make
€ make install

€ gcc reproduce.c -L/tmp/segfaultGrep/lib -lpcre
€ LD_LIBRARY_PATH=/tmp/segfaultGrep/lib ./a.out; echo $?
Segmentation fault (core dumped)
139


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