Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: internal: fuzzers: cmetrics_fuzzer: extend #7745

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/internal/fuzzers/cmetrics_decode_fuzz.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <cmetrics/cmt_decode_opentelemetry.h>
#include <cmetrics/cmt_decode_prometheus.h>


int
Expand All @@ -34,7 +35,7 @@ LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
return 0;
}

decider = data[0] % 2;
decider = data[0] % 3;

/* Adjust data pointer since the first byte is used */
data += 1;
Expand All @@ -54,5 +55,15 @@ LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
cmt_destroy(cmt);
}
}
else if (decider == 2) {
if (size == 0) {
return 0;
}
struct cmt_decode_prometheus_parse_opts opts;
result = cmt_decode_prometheus_create(&cmt, data, size, &opts);
if (result == CMT_DECODE_PROMETHEUS_SUCCESS) {
cmt_decode_prometheus_destroy(cmt);
}
}
return 0;
}