www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17075] New: ctRegex BacktrackingMatcher.prevStack: free():

https://issues.dlang.org/show_bug.cgi?id=17075

          Issue ID: 17075
           Summary: ctRegex BacktrackingMatcher.prevStack: free(): invalid
                    pointer
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: zorael gmail.com

Created attachment 1633
  --> https://issues.dlang.org/attachment.cgi?id=1633&action=edit
Input that triggers the crash

Download http://pastebin.com/raw/UVF41mPf and pipe it into the following:

import std.stdio;
import std.regex;
import std.conv;

enum titlePattern = `<title>(.+)</title>`;
static titleRegex = ctRegex!titlePattern;

void main()
{
    auto content = stdin.byLineCopy.to!string;
    auto hits = content.matchAll(titleRegex);
}

----------

*** Error in `./test': free(): invalid pointer: 0x0000000000f42148 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x70c4b)[0x7fef85a22c4b]
/usr/lib/libc.so.6(+0x76fe6)[0x7fef85a28fe6]
/usr/lib/libc.so.6(+0x777de)[0x7fef85a297de]
./test(nothrow  nogc  trusted bool
std.regex.internal.backtracking.BacktrackingMatcher!(true).BacktrackingMatcher!(char,
std.regex.internal.ir.Input!(char).Input).BacktrackingMatcher.prevStack()+0x90)[0x4
cd2b8]
[...]

Tested on two machines, both running linux.

--
Jan 08 2017