D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10773 - std.algorithm.splitter produces infinite range with empty delimiter
Summary: std.algorithm.splitter produces infinite range with empty delimiter
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2013-08-07 13:15 UTC by hsteoh
Modified: 2013-08-09 11:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description hsteoh 2013-08-07 13:15:56 UTC
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.
Comment 3 hsteoh 2013-08-09 11:34:57 UTC
Fixed in git HEAD.