Bug 11775 – std.regex should check for valid repetition range in assert mode

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-19T08:27:00Z
Last change time
2013-12-20T00:48:53Z
Keywords
pull
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-12-19T08:27:52Z
----- import std.regex; void main() { auto m = "12".match(r"\d{1,0}"); // invalid range } ----- $ dmd -run test.d > [email protected](5019): Range violation Note that the exception is internal while trying to access an invalid index in an array. With -noboundscheck there will be no exceptions thrown. I think at least in assert mode ( version(assert) ) the repetition range should be verified to be valid.
Comment #1 by dmitry.olsh — 2013-12-19T10:13:09Z
https://github.com/D-Programming-Language/phobos/pull/1791 I think it should throw just like any other parse error, after all patterns are user input in certain systems (like editors).
Comment #2 by github-bugzilla — 2013-12-19T12:24:16Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/e598f92224db6e28603e1421d3b3e5e47422bbe5 fix issue 11775 std.regex should check for valid repetition range https://github.com/D-Programming-Language/phobos/commit/ff23ea79975e9ffb7edf16370563b3253a882f99 Merge pull request #1791 from blackwhale/range-bug-regex fix issue 11775 std.regex should check for valid repetition range
Comment #3 by andrej.mitrovich — 2013-12-20T00:48:53Z
Thanks!