PACKRecordEnd carves obj.size straight off the wire — unbounded scratch
PACKRecordEnd (dog/git/PACK.c:184-202) measures a record's extent by inflating it into BASS scratch sized a_carve(u8, sc, obj.size) — and obj.size is the record's own untrusted varint, up to ~2^60. One corrupt or hostile record demands an arbitrary carve: OOM/DoS at every scan site (PIDXScan per record, the js binding via GIT-007). Found in the 2026-07-24 dog/git review. Method: work.
dog/git/PACK.c:197 — a_carve(u8, sc, obj.size ? obj.size : 1); the varint decoder (PACKDrainVarint) happily yields huge sizes.(packlen - offset) * 1032 — anything above that is corruption by construction, rejectable BEFORE carving.ZINFInflate output-wrap is what makes "inflate into a too-small buffer" survivable-but-corrupting; once GIT-011 lands a NOROOM error, a chunked measure loop (fixed small carve, count total_out) becomes the clean way to size-check.dog/git libdog, ABC style; BASS carve rules (abc.mkd §BASS) — the carve stays in the op's own frame.PIDXScan / keeper scan callers and their tests stay green.test(obj.size <= (packlen - offset) * 1032ULL, PACKBADFMT) before the carve (watch the multiply overflow — clamp first). The chunked-measure rewrite can ride with GIT-011.dog/test/ (absurd declared size → bounded error).