Skip to content

Free macro arguments on macro value parse failure, add EOF test - #441

Open
sobomax wants to merge 1 commit into
vstakhov:masterfrom
sippy:fix-macro-eof-overread
Open

sobomax wants to merge 1 commit into
vstakhov:masterfrom
sippy:fix-macro-eof-overread

Conversation

@sobomax

@sobomax sobomax commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

While tracking an OSS-Fuzz crash in rtpproxy's fuzz_config_file (an overread in ucl_parse_macro_value at EOF, already fixed here by 5f98085), I found that the same path still leaks the parsed macro arguments: .priority(a=1) followed by EOF, whitespace or a comment makes ucl_parse_macro_value() fail and the macro_args object is never released.

This PR:

  • unrefs macro_args when ucl_parse_macro_value() fails;
  • adds tests/test_macro_eof.c which places each input right before a PROT_NONE guard page, so it covers the OOB read without sanitizers and the leak under LeakSanitizer.

Verified with an ASan build: the new test fails on current master (leak) and passes with the fix; no other test changes (test_schema already reports leaks under ASan on master, unrelated).

When ucl_parse_macro_value() fails, e.g. because the input ends right
after a macro's arguments such as ".priority(a=1)", the parsed macro
arguments object was leaked. Unref it on that error path.

Also add a regression test that places each input at the end of a
mapped page followed by a PROT_NONE guard page, covering both the
out-of-bounds read fixed in 5f98085 and the leak above (when run under
LeakSanitizer).

Found by OSS-Fuzz (rtpproxy fuzz_config_file).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant