+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
main
| 1 | /* |
| 2 | * SPDX-License-Identifier: AGPL-3.0-or-later WITH Classpath-exception-2.0 |
| 3 | * Copyright (c) 2026 Saif Mukhtar |
| 4 | * |
| 5 | * OpenAVX - Open Audio-Video eXchange |
| 6 | * fuzz/fuzz_config.c - libFuzzer Target for JSON Configuration Parser |
| 7 | */ |
| 8 | |
| 9 | #include <stdint.h> |
| 10 | #include <stddef.h> |
| 11 | #include <stdlib.h> |
| 12 | #include <string.h> |
| 13 | #include "avx_config.h" |
| 14 | |
| 15 | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
| 16 | if (!data || size == 0) return 0; |
| 17 | |
| 18 | /* Ensure payload is null-terminated string */ |
| 19 | char *json_str = (char *)malloc(size + 1); |
| 20 | if (!json_str) return 0; |
| 21 | memcpy(json_str, data, size); |
| 22 | json_str[size] = '\0'; |
| 23 | |
| 24 | avx_config_t cfg; |
| 25 | avx_config_parse_json(json_str, &cfg); |
| 26 | |
| 27 | free(json_str); |
| 28 | return 0; |
| 29 | } |