Snap for 8071527 from 8f4908840cdd9cc2fe0442033516a273046598a2 to sc-v2-release

Change-Id: I94a0098af46f40d2bf0043b4e08f6d0c500a0b81
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*> 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);