Closed ForrestFeng closed 4 years ago
Thanks for this! I'll hopefully get to it soon.
You know what - I've thought about this more, and I don't care that utf8codepoint
returns an invalid pointer. You should check that the out_codepoint
is not 0 (nul terminator) before accessing the return from utf8codepoint
instead.
Sample code to reproduce the issue
It is expected to return (void ) emptystr, but returns (void ) (emptystr+1). The ret is now a bad index. It points to the address after the null terminator!
Suggest to add a null check at the beginning of the function, see below.