aboutsummaryrefslogtreecommitdiff
path: root/src/cppbor_parse.cpp
AgeCommit message (Collapse)Author
2022-01-12Add input validation for 'parseRecursively' method.android-12.1.0_r9android-12.1.0_r8android-12.1.0_r7android-12.1.0_r22android-12.1.0_r21android-12.1.0_r20android-12.1.0_r19android-12.1.0_r11android-12.1.0_r10android12L-devandroid12-qpr3-s7-releaseandroid12-qpr3-s6-releaseandroid12-qpr3-s5-releaseandroid12-qpr3-s4-releaseandroid12-qpr3-s3-releaseandroid12-qpr3-s2-releaseandroid12-qpr3-s1-releaseandroid12-qpr3-releaseHasini Gunasinghe
Bug: 192743373 Test: To be verified with fuzzer test case. Change-Id: If052fcb2b2bbc5e0bfc8cfccc51cef11b9914017
2021-06-25Check for integer overflow in cppbor::parseRecursively.android-12.0.0_r32android-12.0.0_r29android-12.0.0_r28android-12.0.0_r27android-12.0.0_r26android-12.0.0_r21android-12.0.0_r20android-12.0.0_r19android-12.0.0_r18android-12.0.0_r16android12-qpr1-releaseandroid12-qpr1-d-s3-releaseandroid12-qpr1-d-s2-releaseandroid12-qpr1-d-s1-releaseandroid12-qpr1-d-releaseandroid12-devShawn Willden
Bug: 191303307 Test: Fuzzer from bug Change-Id: I98830ec1bd77f152266f35a585d286be13a2551b
2021-04-09Fix integer cast in handleNintAndrei Homescu
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
2021-03-30Error on unknown simple valueAndrew Scull
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
2021-03-30Reject reserved values and indefinite lengthsAndrew Scull
RFC 8949 defines additional information values 28, 29, 30 and 31 as either reserved or indicating indefinite length values. Reject all of these. Test: cppbor_host_test_external Change-Id: Ic9ae7630c8f75d060e4199d375c1f696699a4f66
2021-03-11Add view items for zero-copy parsing of CBOR stringsAndrei Homescu
This CL adds two new ViewTstr and ViewBstr Item types that hold strings as string_view and basic_string_view<uint8_t> types instead of std::string or std::vector<uint8_t>, respectively. This allows for zero-copy parsing of CBOR (mainly strings), which is useful in low-memory environments like the apploader where CBOR data can contain large bstr values. Bug: 115420908 Test: cppbor_host_test_external Change-Id: I69322f0de258e3583cbd842ce240398504a1973f
2020-12-14Change semantic tagging.Shawn Willden
Semantic tagging in libcppbor was a bit cumbersome to use, with tags treated as separate items, requiring code that analyzes tagged data to pay attention to the tags. Among other issues, that violates the intention of semantic tagging in CBOR, which, per the RFC, does not require decoders to understand tags. This CL changes that behavior so that code that walks a parsed Item tree will not "see" the tags unless it looks for them, by calling "Item::semanticTagCount()" and then "Item::semanticTag()". Nested tags are supported. Test: cppbor_test_external Change-Id: Ifa99475fd0d9f369f3e379251979446a2ec262b5
2020-12-14Improve Map canonicalization and add Map iterators.Shawn Willden
This CL changes Map storage to use a vector of pairs, which removes the need to copy the contents twice to sort them and makes it easy to support Map iteration. Support for recursive canonicalization is added as well, and Map::get() uses a binary search when the map is canonicalized. Test: cppbor_test_external Change-Id: Ie7cee5d504e205e1768a26ec5df8436805a6eefe
2020-12-01Remove CompoundItem.Shawn Willden
Refactor to remove CompoundItem. It was a way to share some common code between Array and Map, and later Semantic, but the representations of those classes need to diverge so it adds no value. Test: cppbor_test_external Change-Id: I986e90c1d212f6d81debe4b2f650ba68f065a6ed
2020-11-24Improvements to cppborShawn Willden
1. Add pretty-printing (moved from IdentityCredentialSupport) 2. Add EncodedItem to make it easy to add already-encoded CBOR. 3. Add Map canonicalization. 4. Add support for adding enums as integers. Test: cppbor_test_external Change-Id: I641c87567a11de4641b2fcadebe72dd832fceb51
2020-11-20Apply clang-format.Shawn Willden
Test: cppbor_test_external Change-Id: If907312dc498a241f077de40745c5908fad6c15a
2020-11-11Allow building libcppbor with -fno-rttiBram Bonné
Bug: 171373138 Test: trusty/vendor/google/aosp/scripts/build.py generic-arm64-test-debug Test: m -j Change-Id: Ib8ef8528ed21dc5043cf6fbc2d048c1a657e7be3
2020-10-21Add Trusty support to libcppbor.Bram Bonné
Add a rules.mk file to libcppbor to allow Trusty to depend on it. Additionally, remove dependency on the Android logging framework when running in the Trusty environment, and remove dependencies on stringstream to improve portability. Bug: 171373138 Test: trusty/vendor/google/aosp/scripts/build.py generic-arm64-test-debug Test: m -j Change-Id: I7a01db28e6bf448886f4a7a1a4dea02d569493c9
2020-04-10Adding initial commit for libcppborplatform-tools-30.0.1platform-tools-30.0.0Max Bires
This commit alters the binary names in the Android.bp file to avoid conflicts with the internal copy of libcppbor in hardware/interfaces. Once checked in, the copy will be removed and the binary names will be reverted back to normal. This is to avoid chicken and egg build errors. Test: tests are under tests/ Change-Id: I61355fb05d862a6809ac1e42bce714908da869b2
2020-04-09Revert "Adding the initial commit for libcppbor"Max Bires
This reverts commit a7b145a6a5d05b89e9769ffea84d1068ef32bd4e. Reason for revert: Need to submit with altered binary names Change-Id: I73a6e442fdbd955bbbd9ab03a7c3096deabbc786
2020-04-02Adding the initial commit for libcppborMax Bires
This commit just populates the repository with the code from the google github repository Test: tests/cppbor_test.cpp contains the relevant tests Change-Id: I693c70abbec6919ed0aa477604a0dd6a16f32df2