Skip to content

Commit 19cc8f9

Browse files
committed
tests: add YAML variant leak regression
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
1 parent 5bf08d3 commit 19cc8f9

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

tests/internal/config_format_yaml.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#define FLB_000_WIN FLB_TESTS_CONF_PATH "\\fluent-bit-windows.yaml"
3737
#define FLB_BROKEN_PLUGIN_VARIANT FLB_TESTS_CONF_PATH "/broken_plugin_variant.yaml"
38+
#define FLB_CLUSTERFUZZ_VARIANT_MISSING_KEY FLB_TESTS_CONF_PATH "/clusterfuzz_variant_missing_key.yaml"
3839

3940
#ifdef _WIN32
4041
#define FLB_BASIC FLB_000_WIN
@@ -196,15 +197,24 @@ static void test_customs_section()
196197

197198
static void test_broken_plugin_variant_yaml()
198199
{
200+
char *test_cases[] = {
201+
FLB_BROKEN_PLUGIN_VARIANT,
202+
FLB_CLUSTERFUZZ_VARIANT_MISSING_KEY,
203+
NULL,
204+
};
199205
struct flb_cf *cf;
206+
int i;
200207

201-
cf = flb_cf_yaml_create(NULL, FLB_BROKEN_PLUGIN_VARIANT, NULL, 0);
202-
TEST_CHECK(cf == NULL);
208+
for (i = 0; test_cases[i] != NULL; i++) {
209+
cf = flb_cf_yaml_create(NULL, test_cases[i], NULL, 0);
210+
TEST_CHECK_(cf == NULL,
211+
"config_format created from broken YAML file %s",
212+
test_cases[i]);
203213

204-
if (cf != NULL) {
205-
TEST_CHECK_(cf != NULL, "somewhat config_format is created wrongly");
206-
flb_cf_dump(cf);
207-
flb_cf_destroy(cf);
214+
if (cf != NULL) {
215+
flb_cf_dump(cf);
216+
flb_cf_destroy(cf);
217+
}
208218
}
209219
}
210220

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cUSTOMS: {processors: {{metrics: [O: [],O: [44444444: [/-1,O: [-: [444,O: [-------O: [],O: _T,true],O------O340282366920938463463374607431768211457: [/cUSTOMS: {processors: {{{traceS: {p,[0,O: [-: [0,O: [-------O: [],O: [],true],O------O: [],O: [],true],O,O: C,C,XX],O: [_,O: [],true],-------O: [],O: [],true],O------O: []: {C,[]: {psceSC,444,O: [-------O: [],O: [T,true],O------O44: [/0,O: [-: [0,O: [-------O: [],O: [],true],O------O: [],O: [],true],O,O: C,C,XX],O: [_,O: [],true],-------O: [],O: [],true],O------O: [442,O: [-------O: [],O: [T,true],O------O-9363176467: [/0,O: [-: [107405540802,O: [-------O: [],O: [],true],O------O: [],O: [],true],O,O: C,C,XX],O: [[]:_,O: [],true],-------O: [],O: [],true],O------O: [],O: [],true],O,O: C,C,O,O: C,X],O: [],true

0 commit comments

Comments
 (0)