Skip to content

Commit d753c8e

Browse files
authored
Merge pull request #4729 from rainers/issue16385
Fix issue 16385: std.range: undefined behaviour when skipping over 0xff in string.popFront
2 parents f2210fe + 0d213a9 commit d753c8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

std/range/primitives.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,11 @@ if (isNarrowString!(C[]))
21092109
//ptr is used to avoid unnnecessary bounds checking.
21102110
str = str.ptr[1 .. str.length];
21112111
}
2112+
else if (c == 0xff)
2113+
{
2114+
// bsr undefined for 0
2115+
str = str.ptr[1 .. str.length];
2116+
}
21122117
else
21132118
{
21142119
import core.bitop : bsr;

0 commit comments

Comments
 (0)