TinyCBOR: Fix parsing on big-endian machines
Original commit from https://github.com/thiagomacieira/tinycbor/pull/1 Change-Id: I194d3f37471a49788a7bfffd1594ef5db19465fd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
a367c85e53
commit
0674c870b4
9
src/3rdparty/tinycbor/src/cborparser.c
vendored
9
src/3rdparty/tinycbor/src/cborparser.c
vendored
@ -203,10 +203,13 @@ static CborError preparse_value(CborValue *it)
|
||||
it->extra = 0;
|
||||
|
||||
/* read up to 16 bits into it->extra */
|
||||
if (bytesNeeded <= 2) {
|
||||
if (bytesNeeded == 1) {
|
||||
uint8_t extra;
|
||||
read_bytes_unchecked(it, &extra, 1, bytesNeeded);
|
||||
it->extra = extra;
|
||||
} else if (bytesNeeded == 2) {
|
||||
read_bytes_unchecked(it, &it->extra, 1, bytesNeeded);
|
||||
if (bytesNeeded == 2)
|
||||
it->extra = cbor_ntohs(it->extra);
|
||||
it->extra = cbor_ntohs(it->extra);
|
||||
} else {
|
||||
cbor_static_assert(CborIteratorFlag_IntegerValueTooLarge == (Value32Bit & 3));
|
||||
cbor_static_assert((CborIteratorFlag_IntegerValueIs64Bit |
|
||||
|
Loading…
x
Reference in New Issue
Block a user