Skip to content

Anthropic's OSS Scanner fixes (medium, part 2) - #275

Merged
adamdickmeiss merged 19 commits into
masterfrom
next-findings
Nov 27, 2026
Merged

adamdickmeiss merged 19 commits into
masterfrom
next-findings

Conversation

@adamdickmeiss

@adamdickmeiss adamdickmeiss commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Discovered by Anthropic's OSS Scanner

Resolve prefixes in a temporary copy of the nodes, sharing immutable
strings to avoid multiplying allocations across clauses.

Complete public deep copies of modifiers and extra terms. Add regression
checks for repeated transformations and unchanged caller-owned trees.

Discovered by Anthropic's OSS Scanner as ANT-2026-1QS25EDY.
@adamdickmeiss adamdickmeiss changed the title Preserve caller-owned CQL trees during transformation Anthropic's OSS Scanner fixes (medium, part 2) Nov 27, 2026
Replace sscanf with counted hexadecimal parsing for @xxxx and @uxx
escapes. Require all digits to be valid and pass malformed escapes
through as text.

Prevent out-of-bounds reads, uninitialized character values and
quadratic scanning. Add regression tests for malformed escapes and
input boundaries.

Discovered by Anthropic's OSS Scanner as ANT-2026-J4G2ZDHV.
Treat a trailing escape character as literal instead of skipping the
terminating NUL. Prevent out-of-bounds reads and inconsistent field
counts that can overrun the result array.

Add regression tests covering collapse and escape-substitution modes.

Discovered by Anthropic's OSS Scanner as ANT-2026-CS0JO4LX.
Reserve space for the final arc and terminator instead of silently
dropping excess arcs and writing past the OID_SIZE buffer.

Document the limit and test acceptance of 19 arcs and rejection of
longer OIDs.

Discovered by Anthropic's OSS Scanner as ANT-2026-VT8JOQ3W.
Keep only one released request and its response buffer for reuse,
freeing additional requests so pipelined batches do not retain all
response buffers until the session closes.

Add request queue tests and update existing cache-count expectations.

Discovered by Anthropic's OSS Scanner as ANT-2026-ISZI27GK.
Set the present format, fetch output format, scan attribute set and
update reference ID to NULL before invoking backend handlers. Prevent
stale memory from being interpreted as valid pointers.

Add regression checks for SRU present and update callbacks.

Discovered by Anthropic's OSS Scanner as ANT-2026-R0OYHWHR.
Exercise non-blocking TCP and Unix transports with fragmented input,
repeated reads without new data, and surplus from a second message.
The buffer-swapping fix is already present.

Discovered by Anthropic's OSS Scanner as ANT-2026-Q18M8RIQ.
Accept peers into sockaddr_storage and pass the actual address length
and family to the access callback. Normalize IPv4-mapped IPv6 peers
to IPv4 so existing address rules continue to match.

Return complete peer addresses when the supplied buffer fits and
document the callback's IPv4 and IPv6 address formats.

Discovered by Anthropic's OSS Scanner as ANT-2026-CP0KPR80.
Clear ai_connect after a successful write so later send failures
cannot reconnect to another address and transmit only the remainder
of a message. Preserve fallback for initial connection failures.

Discovered by Anthropic's OSS Scanner as ANT-2026-DVAYQZLV.
Print OCLC UserInformation only after successful decoding and stop
printing GDUs that failed to decode.

Clear failed ItemRequest and ILL APDU results in yaz-ztest before
printing or accessing them.

Discovered by Anthropic's OSS Scanner as ANT-2026-2DZQA1UC.
Close the session and exit the response loop when reconnecting after
a read or decode failure fails. This prevents processing invalid
buffer lengths or partially decoded GDUs.

Discovered by Anthropic's OSS Scanner as ANT-2026-MYIS8I6Z.
Clamp the scan response position to the requested number of terms,
which is limited to 200. This prevents oversized positions from
overflowing the result array or indexing outside the circular word
buffer in Z39.50 and SRU scans.

Discovered by Anthropic's OSS Scanner as ANT-2026-YKLKS3WE.
Reinitialize the variadic argument list after formatting messages for
log handlers. This prevents reuse of a consumed va_list, which could
cause crashes or invalid memory reads when file logging is also enabled.

Discovered by Anthropic's OSS Scanner as ANT-2026-ZD369KSG.
Exit the receive loop when decoding fails or yields something other
than an HTTP response. This prevents unbounded memory and log growth
from repeated invalid messages.

Add a regression test checking that the fetch stops after one read
and returns the expected error.

Discovered by Anthropic's OSS Scanner as ANT-2026-XU0COKAB.
Decode known octet-aligned EXTERNAL contents in place, bounded by the
OCTET STRING length. This prevents nested OPAC records from amplifying
memory usage through a payload copy at every level.

Add regression tests for definite and indefinite nesting, arena usage,
and malformed payload boundaries.

Discovered by Anthropic's OSS Scanner as ANT-2026-YXUJNY3L.
Reject missing buffers and negative lengths before allocating, copying,
or writing serialized XML. Return HTTP 500 when SRU response encoding
fails, and preserve fallback behavior when record formatting fails.

Add a regression test for an unsupported SOAP output charset.

Discovered by Anthropic's OSS Scanner as ANT-2026-4UZ4LNAA.
Use a separate word-list file and working buffer for each scan, and
allocate returned entries and term strings in the request's ODR arena.
This prevents concurrent scans from corrupting results and causing
heap overflows in threaded servers.

Return a diagnostic when dummy-words cannot be opened instead of
terminating the server.

Discovered by Anthropic's OSS Scanner as ANT-2026-XUI08322.
Replace deprecated yaz_retrieval_request calls with
yaz_retrieval_request2, passing the existing NMEM arena.
This removes deprecation warnings while preserving test coverage.
@adamdickmeiss
adamdickmeiss merged commit 2ff6a50 into master Nov 27, 2026
8 of 10 checks passed
@adamdickmeiss
adamdickmeiss deleted the next-findings branch November 27, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant