Skip to content

Commit

Permalink
Merge pull request #2951 from MartinNowak/fix14105
Browse files Browse the repository at this point in the history
fix Issue 14105 - strideImpl fails for 0xFF
  • Loading branch information
schveiguy committed Feb 2, 2015
2 parents 91e37fe + dcf18a0 commit e65a331
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions std/utf.d
Expand Up @@ -187,7 +187,7 @@ body
{
import core.bitop : bsr;
immutable msbs = 7 - bsr(~c);
if (msbs < 2 || msbs > 4)
if (!~c || msbs < 2 || msbs > 4)
throw new UTFException("Invalid UTF-8 sequence", index);
return msbs;
}
Expand Down Expand Up @@ -263,7 +263,7 @@ unittest // invalid start bytes
{
import std.exception: assertThrown;
immutable char[] invalidStartBytes = [
//0b1111_1000, // indicating a sequence length of 5
0b1111_1000, // indicating a sequence length of 5
0b1111_1100, // 6
0b1111_1110, // 7
0b1111_1111, // 8
Expand Down

0 comments on commit e65a331

Please sign in to comment.