Skip to content

Enhance SNMP buffer growth, validate WSDL cache, and harden libmagic - #24676

Open
abiyeenzo wants to merge 9 commits into
php:masterfrom
abiyeenzo:master
Open

abiyeenzo wants to merge 9 commits into
php:masterfrom
abiyeenzo:master

Conversation

@abiyeenzo

Copy link
Copy Markdown

No description provided.

abiyeenzo and others added 4 commits October 25, 2026 10:24
…o-length values

When a response varbind carries a zero-length value (e.g. ASN_NULL) together
with a long OID, doubling val_len alone makes no progress because 0 * 2 == 0.
Grow from the current buffer size as a floor so the probe loop always
advances. Includes a regression test driven by a local test SNMP agent
(proc_open + python3).

Co-authored-by: arena-agent <[email protected]>
…d table sizes

The on-disk WSDL cache lives in a shared directory under a deterministic
file name, so its contents cannot be trusted. The cache reader now tracks
the current position and the end of the file buffer, bounds-checks every
primitive read, validates indices against the allocated type, encoder,
element, binding and function tables, and discards the partially built
SDL when an entry is malformed. Includes a regression test covering
over-declared string lengths and out-of-range table indices.

Co-authored-by: arena-agent <[email protected]>
Size the directory-name stack buffer for its terminator, copy at most
sizeof(name)-1 bytes and terminate explicitly, since a CFB directory entry
may use all 32 UTF-16 name units without a NUL. Stop the second
cdf_unpack_catalog() record loop when a zero-length record is encountered
so the cursor cannot stall on the same record. Includes a pure-PHP CFB
builder regression test covering both cases.

Co-authored-by: arena-agent <[email protected]>
…cache validation and bundled libmagic CDF hardening

Co-authored-by: arena-agent <[email protected]>
abiyeenzo and others added 5 commits October 25, 2026 13:42
The assertion of interest is that a malformed cache entry is rejected and
unlinked; broaden the catch so an environment-specific failure mode of the
subsequent WSDL fetch cannot mask the cache-validation result.

Co-authored-by: arena-agent <[email protected]>
Temporary bisection commit; the skip will be reverted once the failing
test is identified.

Co-authored-by: arena-agent <[email protected]>
Temporary bisection step; keeps the new tests skipped and the other
fixes intact. Will be restored once the regression source is identified.

Co-authored-by: arena-agent <[email protected]>
The on-disk cache assigns encoder indices to both custom encoders and the
built-in default encoders (see sdl_serialize), so a deserialized index may
legitimately exceed num_encoders. Bounding references against num_encoders
wrongly rejected almost every valid cached WSDL; the correct upper bound is
the final index after the default encoders are appended.

Also replace unbounded flag-byte peeks (in->p[0]) with a bounds-checked
PEEK helper so a truncated cache cannot trigger an out-of-bounds read under
ASan, and re-enable the three regression tests.

Co-authored-by: arena-agent <[email protected]>
Second bisection step to separate remaining C-code regressions from test
script issues. Temporary; skips will be reverted.

Co-authored-by: arena-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant