diff options
author | Xin Li <delphij@google.com> | 2021-08-14 06:30:56 +0000 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2021-08-14 06:30:56 +0000 |
commit | 3d50375056638a74ee9bce3b2e2e10ee8f3a9442 (patch) | |
tree | a7b0c82cc4b342d22a22e671d64980a5384e3949 | |
parent | 1b23995a6ba5df2ae499ab1a7179b07462bf34de (diff) | |
parent | d7ace4469d1ea1acefce0f0922e97d814b6970ac (diff) | |
download | libcppbor-3d50375056638a74ee9bce3b2e2e10ee8f3a9442.tar.gz |
Merge sc-dev-plus-aosp-without-vendor@7634622temp_sam_202323961
Merged-In: Ia7a8b4e355aa9086135422fd1e45996ab1731108
Change-Id: I924b3ddd6fd350227c02d9a15857de5102311a32
-rw-r--r-- | src/cppbor_parse.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cppbor_parse.cpp b/src/cppbor_parse.cpp index f5e8fcf..964a72d 100644 --- a/src/cppbor_parse.cpp +++ b/src/cppbor_parse.cpp @@ -96,7 +96,8 @@ std::tuple<const uint8_t*, ParseClient*> handleString(uint64_t length, const uin const uint8_t* valueBegin, const uint8_t* end, const std::string& errLabel, ParseClient* parseClient) { - if (end - valueBegin < static_cast<ssize_t>(length)) { + ssize_t signed_length = static_cast<ssize_t>(length); + if (end - valueBegin < signed_length || signed_length < 0) { parseClient->error(hdrBegin, insufficientLengthString(length, end - valueBegin, errLabel)); return {hdrBegin, nullptr /* end parsing */}; } |