Skip to content

Commit

Permalink
decode: adjust NULL-dereference fix
Browse files Browse the repository at this point in the history
Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski committed Oct 14, 2023
1 parent 0e0dd95 commit 77b4c9d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/cmt_decode_msgpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,9 @@ static int unpack_basic_type_meta(mpack_reader_t *reader, size_t index, void *co

if (CMT_DECODE_MSGPACK_SUCCESS == result) {
decode_context->map->label_count = cfl_list_size(&decode_context->map->label_keys);
if (decode_context->map == NULL || decode_context->map->parent == NULL) {
return CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR;
}

if (decode_context->map->type == CMT_HISTOGRAM) {
histogram = (struct cmt_histogram *) decode_context->map->parent;
Expand Down Expand Up @@ -1006,12 +1009,7 @@ static int unpack_basic_type_meta(mpack_reader_t *reader, size_t index, void *co
}
else if(decode_context->map->type == CMT_COUNTER) {
counter = (struct cmt_counter *) decode_context->map->parent;
if (counter == NULL) {
result = CMT_DECODE_MSGPACK_ALLOCATION_ERROR;
}
else {
counter->aggregation_type = decode_context->aggregation_type;
}
counter->aggregation_type = decode_context->aggregation_type;
}
}

Expand Down

0 comments on commit 77b4c9d

Please sign in to comment.