MEM-001: BSDPatch untrusted-patch integer overflows (abc/BSD.c)

Now
DONE

BSDPatch decodes lengths and counts straight from an untrusted BSDIFF01 patch and checks them with additive comparisons that wrap, so a crafted patch defeats every bounds guard and drives an unbounded attacker-controlled memcpy into the caller's neu buffer (ASan-reproduced) plus wild-pointer OOB reads. The goal is to bound every patch-derived field with subtraction (no wrap) and re-validate source pointers against the patch end before each copy.

Issues

Three signed-overflow holes in one function, all reachable from a single malformed patch.

Blockers

None. BSDPatch is exported in abc/BSD.h; only in-tree caller today is abc/test/BSD.c:37, but the API's whole contract is consuming serialized (untrusted) bytes.

Planned

Make all patch-field arithmetic overflow-safe and add a crafted-patch repro.