Bug 10773 – std.algorithm.splitter produces infinite range with empty delimiter
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-07T13:15:00Z
Last change time
2013-08-09T11:34:57Z
Keywords
pull
Assigned to
nobody
Creator
hsteoh
Comments
Comment #0 by hsteoh — 2013-08-07T13:15:56Z
Calling std.algorithm.splitter with a non-empty string and an empty delimiter causes it to produce an infinite range of empty strings. This, in turn, causes std.array.split to get into an infinite loop when it is called with an empty delimiter.
When the delimiter is empty, std.algorithm.splitter should return a range containing 1-element ranges of each element in the original range. (Cf. Perl's split(//, "string").) At the very least, std.array.split should not have an infinite loop.