Skip to content

smoke: handle allocation failure and NULL te_compile() result - #147

Closed
warter666 wants to merge 1 commit into
codeplea:masterfrom
warter666:fix/smoke-null-checks
Closed

warter666 wants to merge 1 commit into
codeplea:masterfrom
warter666:fix/smoke-null-checks

Conversation

@warter666

Copy link
Copy Markdown

Two robustness issues in the smoke test, both found with cppcheck/clang static analysis:

  1. test_deep_nesting()-style depth tests malloc() the expression buffer and immediately memset/index it; on allocation failure this is a NULL dereference. Now records a failure via lok(0) and skips the case.
  2. The equivalence test table calls te_compile() then dereferences the result right after lok(ex); if compilation fails the test binary itself crashes instead of reporting a failed test. Now continues after the failed lok() (still counted as a failure).

Full suite still passes after the change: 10080/10080 under ASan+UBSan.

Signed-off-by: warter666 121139223+Warterkk@users.noreply.github.com

Two robustness issues in the smoke test, both found with cppcheck/clang static analysis:

1. `test_deep_nesting()`-style depth tests `malloc()` the expression buffer and immediately memset/index it; on allocation failure this is a NULL dereference. Now records a failure via `lok(0)` and skips the case.
2. The equivalence test table calls `te_compile()` then dereferences the result right after `lok(ex)`; if compilation fails the test binary itself crashes instead of reporting a failed test. Now `continue`s after the failed `lok()` (still counted as a failure).

Full suite still passes after the change: 10080/10080 under ASan+UBSan.

Signed-off-by: warter666 <121139223+Warterkk@users.noreply.github.com>
@codeplea

Copy link
Copy Markdown
Owner

Fixed. Thank you.

@codeplea codeplea closed this Sep 21, 2026
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.

2 participants