Bug 12713 – [REG 2.066A] std.regex.regex crashes with SEGV, illegal instruction resp. assertion failure with certain bad input

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-05-08T06:30:00Z
Last change time
2014-05-13T23:08:31Z
Keywords
pull
Assigned to
dmitry.olsh
Creator
yxcvbasdfgqwert02

Attachments

IDFilenameSummaryContent-TypeSize
1356dvt7.dSource code for test casetext/x-dsrc415

Comments

Comment #0 by yxcvbasdfgqwert02 — 2014-05-08T06:30:49Z
Created attachment 1356 Source code for test case The bad regular expression "[[a-z]([a-z]|(([[a-z])))" seems to run an unexpected execution path during regular expression compilation which ended up in a segmentation fault (if compiled with -release) or an assertion failure (if not). Verified with dmd 2.065 and ldc2-0.12-1 (the latter causes an 'illegal instruction' crash if compiled with -release). Instead of crashing, the bad expression should be rejected with a proper exception like "wrong character class" (as for other syntactically wrong expressions). Note: the terms "[[a-z]" were intended to be "[\\[a-z]".
Comment #1 by dmitry.olsh — 2014-05-12T16:05:04Z
Comment #2 by dmitry.olsh — 2014-05-12T16:34:44Z
Comment #3 by github-bugzilla — 2014-05-13T23:08:30Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0507fd70e87de758f28347ba408912e7a4186978 Fix issue 12713 std.regex.regex crashes with SEGV, illegal instruction resp. assertion failure with certain bad input https://github.com/D-Programming-Language/phobos/commit/d1e2f2b0650158e4aa7cab536fde24200c6e6e4a Merge pull request #2165 from DmitryOlshansky/issue-12713 Fix issue 12713 std.regex.regex crashes with SEGV, illegal instruction r...