Skip to content

Commit d3c47d2

Browse files
Valiation: suppress warning about uninitialized variables
GCC7 complains, though it's wrong: src/cborvalidation.c:472:57: error: ‘previous’ may be used uninitialized in this function [-Werror=maybe-uninitialized] src/cborvalidation.c:485:61: error: ‘previous_end’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Signed-off-by: Thiago Macieira <[email protected]>
1 parent f39dcb8 commit d3c47d2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/cborvalidation.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,16 +436,15 @@ static CborError validate_container(CborValue *it, int containerType, int flags,
436436
{
437437
CborError err;
438438
const uint8_t *previous = NULL;
439-
const uint8_t *previous_end;
439+
const uint8_t *previous_end = NULL;
440440

441441
if (!recursionLeft)
442442
return CborErrorNestingTooDeep;
443443

444444
while (!cbor_value_at_end(it)) {
445-
const uint8_t *current;
445+
const uint8_t *current = cbor_value_get_next_byte(it);
446446

447447
if (containerType == CborMapType) {
448-
current = it->ptr;
449448
if (flags & CborValidateMapKeysAreString) {
450449
CborType type = cbor_value_get_type(it);
451450
if (type == CborTagType) {

0 commit comments

Comments
 (0)