-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
truncation of constant value in to_cbor() #1286
Copy link
Copy link
Closed
Labels
aspect: binary formatsBSON, CBOR, MessagePack, UBJSONBSON, CBOR, MessagePack, UBJSONrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
Metadata
Metadata
Assignees
Labels
aspect: binary formatsBSON, CBOR, MessagePack, UBJSONBSON, CBOR, MessagePack, UBJSONrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Although documentation for
static void to_cbor(const basic_json& j, detail::output_adapter<char> o)says nothing I assumed that it has some purpose but f.e. following sample:generates lots of warnings like
in class binary_writer
at lines like:
json/single_include/nlohmann/json.hpp
Line 7949 in e426219
or
json/single_include/nlohmann/json.hpp
Lines 7955 to 7958 in e426219
Basically the cause for that is
static_cast<CharType>(/*some integer value > 127*/)withCharType = charleads to loss of integer value (sizeof(char) is 1 byte and it is signed, so value range is [-128;127] and it can't fit integer number > 127).I don't know if it is an issue but that code smells.