← Back to index
|
Original Bugzilla link
Bug 22273 – Range violation in compile-time regex
Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-09-04T00:18:12Z
Last change time
2024-12-01T16:39:14Z
Assigned to
No Owner
Creator
Steve Bremer
Moved to GitHub: phobos#10473 →
Comments
Comment #0
by stephen.bremer — 2021-09-04T00:18:12Z
There is a range violation when running the following code on an input of 7,168 or more characters (possibly relevant: 2^13 - 2^10 = 7,168). Of note, the runtime regex (i.e., auto re = regex(r"-+(a|b)");) works without errors. import std.regex; void main() { string line = "------------..."; // This is actually 7,168 (or more) dashes auto re = ctRegex!(`-+(a|b)`); line.matchAll(re); } $ ./badregex core.exception.RangeError@/snap/dmd/102/bin/../import/phobos/std/regex/internal/backtracking.d(730): Range violation ---------------- ??:? _d_arrayboundsp [0x55bebee52f81] ??:? pure nothrow @nogc @trusted void std.regex.internal.backtracking.BacktrackingMatcher!(char, std.regex.internal.ir.Input!(char).Input).BacktrackingMatcher.stackPop!(uint).stackPop(ref uint) [0x55bebee41a29] ??:? @trusted bool std.regex.ctRegexImpl!("-+(a|b)", []).func(std.regex.internal.backtracking.BacktrackingMatcher!(char, std.regex.internal.ir.Input!(char).Input).BacktrackingMatcher) [0x55bebee141a8] ??:? @trusted int std.regex.internal.backtracking.BacktrackingMatcher!(char, std.regex.internal.ir.Input!(char).Input).BacktrackingMatcher.matchImpl() [0x55bebee32e36] ??:? @trusted int std.regex.internal.backtracking.BacktrackingMatcher!(char, std.regex.internal.ir.Input!(char).Input).BacktrackingMatcher.matchFinalize() [0x55bebee32b8b] ??:? @trusted int std.regex.internal.backtracking.BacktrackingMatcher!(char, std.regex.internal.ir.Input!(char).Input).BacktrackingMatcher.match(std.regex.internal.ir.Group!(ulong).Group[]) [0x55bebee32d46] ??:? void std.regex.RegexMatch!(immutable(char)[]).RegexMatch.__ctor!(const(std.regex.internal.ir.Regex!(char).Regex)).__ctor(immutable(char)[], const(std.regex.internal.ir.Regex!(char).Regex)).__lambda3!(std.regex.internal.ir.Group!(ulong).Group[]).__lambda3(std.regex.internal.ir.Group!(ulong).Group[]) [0x55bebee41630] ??:? void std.regex.internal.ir.SmallFixedArray!(std.regex.internal.ir.Group!(ulong).Group, 3u).SmallFixedArray.mutate(scope void delegate(std.regex.internal.ir.Group!(ulong).Group[])) [0x55bebee41420] ??:? ref @trusted std.regex.RegexMatch!(immutable(char)[]).RegexMatch std.regex.RegexMatch!(immutable(char)[]).RegexMatch.__ctor!(const(std.regex.internal.ir.Regex!(char).Regex)).__ctor(immutable(char)[], const(std.regex.internal.ir.Regex!(char).Regex)) [0x55bebee415f7] ??:? @safe std.regex.RegexMatch!(immutable(char)[]).RegexMatch std.regex.matchMany!(std.regex.CTRegexWrapper!(char).CTRegexWrapper, immutable(char)[]).matchMany(immutable(char)[], ref std.regex.CTRegexWrapper!(char).CTRegexWrapper) [0x55bebee40555] ??:? @safe std.regex.RegexMatch!(immutable(char)[]).RegexMatch std.regex.matchAll!(immutable(char)[], std.regex.CTRegexWrapper!(char).CTRegexWrapper).matchAll(immutable(char)[], std.regex.CTRegexWrapper!(char).CTRegexWrapper) [0x55bebee4043f] ??:? _Dmain [0x55bebee14064] Tested with: DMD v2.090.1, v2.096.0, and v2.097.2 Tested with DMD
Comment #1
by robert.schadek — 2024-12-01T16:39:14Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/phobos/issues/10473
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB