aboutsummaryrefslogtreecommitdiff
path: root/src/cppbor_parse.cpp
diff options
context:
space:
mode:
authorAndrew Scull <ascull@google.com>2021-03-30 12:53:04 +0000
committerAndrew Scull <ascull@google.com>2021-03-30 16:44:10 +0000
commitbdc577b46b966204b44de984308a0326624c860c (patch)
tree25b8078d37783ecca96cdf6677de6322035ce15d /src/cppbor_parse.cpp
parent42a7aa8fbfe401dcb06cd07f7f9242a1ef3b9627 (diff)
downloadlibcppbor-bdc577b46b966204b44de984308a0326624c860c.tar.gz
Error on unknown simple value
Null, true and false are handled but any other simple value, or floating pointer value, would otherwise reach the CHECK() that was expected to be unreachable. Instead, error when an unhandled value is seen. Test: cppbor_host_test_external Change-Id: Idb1099bbc51649e5eb8f5fb4fa60553e8cbe7e8f
Diffstat (limited to 'src/cppbor_parse.cpp')
-rw-r--r--src/cppbor_parse.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cppbor_parse.cpp b/src/cppbor_parse.cpp
index fcf0dac..ab01ee7 100644
--- a/src/cppbor_parse.cpp
+++ b/src/cppbor_parse.cpp
@@ -275,6 +275,9 @@ std::tuple<const uint8_t*, ParseClient*> parseRecursively(const uint8_t* begin,
return handleBool(addlData, begin, pos, parseClient);
case NULL_V:
return handleNull(begin, pos, parseClient);
+ default:
+ parseClient->error(begin, "Unsupported floating-point or simple value.");
+ return {begin, nullptr};
}
}
CHECK(false); // Impossible to get here.