aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-01-13 00:05:52 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-01-13 00:05:52 +0000
commit402143bbcbc2ee07c09b2eb4a7c91e5ab6808d32 (patch)
tree8001d1f036eb96b6757a6ce86e2018de9d1295ac
parentda91e20fe73e618932eba76ae415a8dbd9b7e894 (diff)
parent8f4908840cdd9cc2fe0442033516a273046598a2 (diff)
downloadlibcppbor-android12L-platform-release.tar.gz
Change-Id: I94a0098af46f40d2bf0043b4e08f6d0c500a0b81
-rw-r--r--src/cppbor_parse.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cppbor_parse.cpp b/src/cppbor_parse.cpp
index 964a72d..9d388a3 100644
--- a/src/cppbor_parse.cpp
+++ b/src/cppbor_parse.cpp
@@ -195,6 +195,13 @@ std::tuple<const uint8_t*, ParseClient*> handleCompound(
std::tuple<const uint8_t*, ParseClient*> parseRecursively(const uint8_t* begin, const uint8_t* end,
bool emitViews, ParseClient* parseClient) {
+ if (begin == end) {
+ parseClient->error(
+ begin,
+ "Input buffer is empty. Begin and end cannot point to the same location.");
+ return {begin, nullptr};
+ }
+
const uint8_t* pos = begin;
MajorType type = static_cast<MajorType>(*pos & 0xE0);