utf.hpp icon indicating copy to clipboard operation
utf.hpp copied to clipboard

potential bug in utf8 encode

Open jurgen-kluft opened this issue 8 years ago • 0 comments

If size_t len = write_length(c); returns 0 then the next loop will cause a serious issue:

for (size_t i = len; i != 1; --i) { // select lower 6 bits res[i-1] = (c & 0x3f) | 0x80; c = c >> 6; }

jurgen-kluft avatar Apr 04 '16 00:04 jurgen-kluft