diff options
author | Andrei Homescu <ah@immunant.com> | 2021-04-02 23:14:02 -0700 |
---|---|---|
committer | Andrei Homescu <ah@immunant.com> | 2021-04-09 21:17:18 -0700 |
commit | a7ca25a181f92bc4d4db75f4994939f5cbd1d788 (patch) | |
tree | 31e098ee8aef09d4327027589b0cdef6f631e004 | |
parent | f3e77b27817305a2da67113febfbdecf9a519cc0 (diff) | |
download | libcppbor-a7ca25a181f92bc4d4db75f4994939f5cbd1d788.tar.gz |
Fix integer cast in handleNint
This fixes an incorrect integer cast in the handleNint function
in cppbor_parse.cpp which would trigger UBSAN failures in the
Trusty apploader.
Change-Id: Id35865e524c9837d907fe352feac783b3f7f36b0
-rw-r--r-- | src/cppbor_parse.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cppbor_parse.cpp b/src/cppbor_parse.cpp index ab01ee7..f5e8fcf 100644 --- a/src/cppbor_parse.cpp +++ b/src/cppbor_parse.cpp @@ -71,7 +71,7 @@ std::tuple<const uint8_t*, ParseClient*> handleNint(uint64_t value, const uint8_ parseClient->error(hdrBegin, "NINT values that don't fit in int64_t are not supported."); return {hdrBegin, nullptr /* end parsing */}; } - std::unique_ptr<Item> item = std::make_unique<Nint>(-1 - static_cast<uint64_t>(value)); + std::unique_ptr<Item> item = std::make_unique<Nint>(-1 - static_cast<int64_t>(value)); return {hdrEnd, parseClient->item(item, hdrBegin, hdrEnd /* valueBegin */, hdrEnd /* itemEnd */)}; } |