Skip to content

Commit

Permalink
Merge pull request #4729 from rainers/issue16385
Browse files Browse the repository at this point in the history
Fix issue 16385:  std.range: undefined behaviour when skipping over 0xff in string.popFront
  • Loading branch information
dnadlinger committed Aug 14, 2016
2 parents f2210fe + 0d213a9 commit d753c8e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions std/range/primitives.d
Expand Up @@ -2109,6 +2109,11 @@ if (isNarrowString!(C[]))
//ptr is used to avoid unnnecessary bounds checking.
str = str.ptr[1 .. str.length];
}
else if (c == 0xff)
{
// bsr undefined for 0
str = str.ptr[1 .. str.length];
}
else
{
import core.bitop : bsr;
Expand Down

0 comments on commit d753c8e

Please sign in to comment.