Ensure til::u8u16 still works if the string consists of just a lead byte#4685
Ensure til::u8u16 still works if the string consists of just a lead byte#46851 commit merged intomicrosoft:masterfrom german-one:dev/duhowett/cherry-pick-3003
Conversation
… single lead byte only (GH#4673) # Conflicts: # src/inc/til/u8u16convert.h # src/til/ut_til/u8u16convertTests.cpp
DHowett-MSFT
left a comment
There was a problem hiding this comment.
I'm happy with this. I had to sit down with a pad and pencil to make sure I understood how sequebnceLen/stopLen worked w/ the partial masks, but I do understand it now and this seems like the correct fix. I changed the title a little bit to make it fit in a single git commit title. 😄
|
Love it. Thanks! |
|
@msftbot merge this in 1 minute |
|
Hello @DHowett-MSFT! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
|
Hello @DHowett-MSFT! Because this pull request has the Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 51 seconds. No worries though, I will be back when the time is right! 😉 p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
🎉 Once again, thanks for the contribution! This pull request was included in a set of conhost changes that was just |
Summary of the Pull Request
Fixes a flaw that happened if
til::u8u16received a single lead byte.PR Checklist
til :: u8u16may fail #4673Detailed Description of the Pull Request / Additional comments
The loop for caching partials didn't run and thus, the lead byte was
converted to U+FFFD. That's because the loop starts with
sequenceLeninitialized with 1. And if the string has a length of 1 the initial
condition is
1<1which is evaluated tofalseand the body of theloop was never executed.
Validation Steps Performed
printf "\xE2"; printf "\x98\xBA\n"prints a U+263A charactercached
consists of a lead byte only