net: lwm2m: Fix range of integers in SenML CBOR

This fixes a minor bug that caused an error if one attempted to encode
or decode INT64_MIN in SenML CBOR

Signed-off-by: Markus Rekdal <markus.rekdal@nordicsemi.no>
This commit is contained in:
Markus Rekdal 2022-05-27 15:50:56 +02:00 committed by Carles Cufí
parent 0006f2c93e
commit 3d8f938929
2 changed files with 8 additions and 8 deletions

View file

@ -51,8 +51,8 @@ static bool decode_repeated_record_union(zcbor_state_t *state, struct record_uni
bool tmp_result = (((zcbor_union_start_code(state) && (int_res = (
((((zcbor_uint32_expect_union(state, (2)))) &&
(zcbor_int64_decode(state, (&(*result)._union_vi))) &&
((((*result)._union_vi >= -9223372036854775807LL) &&
((*result)._union_vi <= 9223372036854775807LL)) ||
((((*result)._union_vi >= INT64_MIN) &&
((*result)._union_vi <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) &&
(((*result)._record_union_choice = _union_vi) || 1)) ||
((((zcbor_uint32_expect_union(state, (2)))) &&
@ -87,8 +87,8 @@ static bool decode_value(zcbor_state_t *state, struct value_ *result)
(((zcbor_bstr_decode(state, (&(*result)._value_bstr)))) &&
(((*result)._value_choice = _value_bstr) || 1)) ||
(((zcbor_int64_decode(state, (&(*result)._value_int))) &&
((((*result)._value_int >= -9223372036854775807LL) &&
((*result)._value_int <= 9223372036854775807LL)) ||
((((*result)._value_int >= INT64_MIN) &&
((*result)._value_int <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false))) &&
(((*result)._value_choice = _value_int) || 1)) ||
(((zcbor_float_decode(state, (&(*result)._value_float)))) &&

View file

@ -50,8 +50,8 @@ static bool encode_repeated_record_union(zcbor_state_t *state, const struct reco
bool tmp_result =
(((((*input)._record_union_choice == _union_vi) ?
(((zcbor_uint32_put(state, (2)))) &&
((((*input)._union_vi >= -9223372036854775807LL) &&
((*input)._union_vi <= 9223372036854775807LL)) ||
((((*input)._union_vi >= INT64_MIN) &&
((*input)._union_vi <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._union_vi)))) :
(((*input)._record_union_choice == _union_vf) ?
@ -83,8 +83,8 @@ static bool encode_value(zcbor_state_t *state, const struct value_ *input)
(((*input)._value_choice == _value_bstr) ?
((zcbor_bstr_encode(state, (&(*input)._value_bstr)))) :
(((*input)._value_choice == _value_int) ?
(((((*input)._value_int >= -9223372036854775807LL) &&
((*input)._value_int <= 9223372036854775807LL)) ||
(((((*input)._value_int >= INT64_MIN) &&
((*input)._value_int <= INT64_MAX)) ||
(zcbor_error(state, ZCBOR_ERR_WRONG_RANGE), false)) &&
(zcbor_int64_encode(state, (&(*input)._value_int)))) :
(((*input)._value_choice == _value_float) ?