blueoil
blueoil copied to clipboard
The format specifier of std::sprintf is incorrect
The variable len
is int
, but %u
is used.
This may cause UB(but the compiler doesn't say any errors or warnings. ref. https://stackoverflow.com/questions/11303784/why-doesnt-gcc-wformat-warn-about-printf-d-on-an-unsigned-int)
We should use %d
instead, or change the type of len
to unsigned int
.
Using other C++ STL (like std::stringstream
) is also good, I think.
https://github.com/blue-oil/blueoil/blob/3510e3f12f4f4ef7f5c9b0c0c784e1cdc2a74a38/blueoil/converter/templates/include/npy.hpp#L104