Proposed PR branch: qe/issue-06-malloc4k-hardening
Category: Bug (memory safety hardening)
Problem
malloc_aligned_4k() must reject sizes that overflow internal calculations.
- Library code paths should not print to stderr on allocation failures.
Justification / why this is needed
- Overflow in allocation-size math is a classic memory safety footgun; even if
not exploitable, it can cause crashes and silent data corruption.
- Printing to stderr from a library is hostile to integrators (pollutes logs,
breaks structured logging, and can leak details in restricted environments).
- Baseline+regtests showed the overflow guard + quiet-failure expectations
failing, while the enhanced tree passes.
Proposed change
- Add explicit overflow checks.
- Remove stderr prints on failure paths.
- Add regression tests for overflow guard and “quiet failure”.
Acceptance criteria
- Overflow-size requests return
NULL.
- No unexpected stderr output for allocation failure paths.
- Regression tests cover both behaviors.
Test plan
make test (expects tests/testDriver_malloc4k.c to pass).
References
- Baseline report:
artifacts/FINAL_BASELINE_ENHANCEMENT_REPORT.md shows two
malloc4k regressions failing on baseline+regtests and passing in enhanced.
- Key files:
zdnn/malloc4k.c, tests/testDriver_malloc4k.c.
Proposed PR branch:
qe/issue-06-malloc4k-hardeningCategory:
Bug(memory safety hardening)Problem
malloc_aligned_4k()must reject sizes that overflow internal calculations.Justification / why this is needed
not exploitable, it can cause crashes and silent data corruption.
breaks structured logging, and can leak details in restricted environments).
failing, while the enhanced tree passes.
Proposed change
Acceptance criteria
NULL.Test plan
make test(expectstests/testDriver_malloc4k.cto pass).References
artifacts/FINAL_BASELINE_ENHANCEMENT_REPORT.mdshows twomalloc4k regressions failing on baseline+regtests and passing in enhanced.
zdnn/malloc4k.c,tests/testDriver_malloc4k.c.