sheredom / utf8.h

📚 single header utf8 string functions for C and C++
The Unlicense
1.69k stars 123 forks source link

Fix utf8ncpy not to refer uninitialized value. #90

Closed falsycat closed 2 years ago

falsycat commented 2 years ago

I fixed an issue that utf8ncpy referred dst even if n is zero.

valgrind said:

==550== Conditional jump or move depends on uninitialised value(s)
==550==    at 0x10C2BB: utf8ncpy (utf8.h:644)
falsycat commented 2 years ago

Oh too many errors in clang... Should I fix these in this PR?

D:\a\utf8.h\utf8.h\test\..\utf8.h(334,17): error : implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion] [D:\a\utf8.h\utf8.h\build\utf8_test.vcxproj]
...
sheredom commented 2 years ago

Argh damn - first off, thanks for the fix! Secondly, if you are happy to fix the issues then I'd totally accept that. I think that there was some change or update to the clang used in github actions which has thrown out a bunch of my libs sadly.

If you dont' want to commit to the fixes then I can pull this PR into one of my own, and fix the issues there. Up to you!

falsycat commented 2 years ago

I've fixed them. :3

sheredom commented 2 years ago

What a legend - thanks!