Skip to content

Commit ad86158

Browse files
DavidKorczynskiedsiper
authored andcommitted
decode_msgpack: fix NULL deref
Fixes: https://issues.oss-fuzz.com/issues/429003372 Signed-off-by: DavidKorczynski <[email protected]>
1 parent 1d474df commit ad86158

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmt_decode_msgpack.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,11 @@ static int unpack_metric(mpack_reader_t *reader,
668668

669669
if (decode_context->map->type == CMT_HISTOGRAM) {
670670
histogram = decode_context->map->parent;
671-
671+
if (histogram == NULL || histogram->buckets == NULL) {
672+
free(metric);
673+
cmt_errno();
674+
return CMT_DECODE_MSGPACK_ALLOCATION_ERROR;
675+
}
672676
metric->hist_buckets = calloc(histogram->buckets->count + 1, sizeof(uint64_t));
673677

674678
if (metric->hist_buckets == NULL) {

0 commit comments

Comments
 (0)