Variant analysis: 1 unfixed sibling safety gap in protobuf
Summary
Variant analysis of historical fixes in protobuf identified 1 code site where an integer-overflow guard, bounds check, or safe-allocation wrapper exists at one location but is missing at a structurally identical sibling location (same file, same function, or same pattern family) elsewhere in the codebase.
Each finding below is code-confirmed against the current HEAD (verified by cloning the repository fresh and checking the pattern is still present), with the exact file/line locations, the root cause, a description of the trigger path, and — where available — ASan/execution verification output or a proof-of-concept.
Note on origin: these were surfaced by an automated variant-analysis pipeline that diffs historical fix commits against sibling code paths, then has each candidate manually reviewed. I'm posting them together per-project rather than as separate issues to respect maintainer time. Happy to split, close, or reprioritize any of these as you see fit.
Finding 1: protobuf — upb_strtable_copy() missing overflow check (sibling of upb_strtable_init() fix in c6b856d)
Verified against HEAD: 99f6640631b66b52853278f631226da808e8c9f6 (2026-09-25)
*- Project: protobuf (protocolbuffers/protobuf, upb C micro-library)
- Class: Heap-buffer-overflow write (via integer overflow in allocation size for hash table copy)
- Status: Code-confirmed, exec-blocked
- Sibling of: Fix commit
c6b856d— convertedupb_strtable_init()and ~15 other allocation sites to useupb_MulOverflow()for overflow-safe multiplication*
Discovery method
Variant analysis. Commit c6b856d was a large overflow-check overhaul that converted ~15 table_size * sizeof(T) patterns to use upb_MulOverflow() — a function that returns false on overflow instead of wrapping. Three sites in the same files were missed: upb_strtable_copy(), and two table clear functions.
Vulnerable code
third_party/upb/upb/hash/common.c
FIXED — upb_strtable_init() after c6b856d:
// SAFE:
size_t bytes;
if (!upb_MulOverflow(t->table_size, sizeof(upb_tabent), &bytes))
return false;
t->entries = upb_gmalloc(bytes);UNFIXED siblings:
upb_strtable_copy()at line 601:
// VULNERABLE — no overflow check:
t->entries = upb_gmalloc(t->table_size * sizeof(upb_tabent));upb_inttable_clear()at line 561:
// VULNERABLE:
upb_inttable_clear(t, upb_gmalloc(t->table_size * sizeof(upb_tabent)));upb_strtable_clear()at line 747:
// VULNERABLE:
upb_strtable_clear(t, upb_gmalloc(t->table_size * sizeof(upb_tabent)));upb_strtable_compact()at line 1023:
// VULNERABLE:
upb_strtable_clear(t, upb_gmalloc(t->table_size * sizeof(upb_tabent)));Root cause
The overflow-check overhaul (c6b856d) was thorough but mechanically incomplete — it converted init() functions across the hash table module but missed copy(), clear(), and compact() functions that use the identical table_size * sizeof(T) pattern. The init() and copy() functions are literally adjacent in the source file.
Trigger path
- Crafted protobuf binary with a deeply nested or large-repeated message
- → Deserialization triggers string table reallocation (
upb_strtable_copy/upb_strtable_compact) - → Large
table_size(e.g., ~2³¹ on 32-bit) → multiplication wraps → undersized allocation → heap overflow write when entries are inserted
Fuzz harness: protobuf_protobuf_fuzzer (an OSS-Fuzz/fuzzbench harness) — exercises protobuf parsing including the upb runtime.
Sibling-gap quality
Excellent. Same file (hash/common.c), same multiplication pattern (table_size * sizeof(T)), same upb_MulOverflow() API that was already used to fix init()`. Three sibling functions missed within the same translation unit.
Analysis date: 2026-09-22. Code-confirmed, not execution-verified.
Methodology
For each historical vulnerability fix in the codebase, we identified the safe pattern the fix introduced (an overflow guard, a safe allocator wrapper, a bounds check) and searched the rest of the codebase for structurally identical code that predates or postdates the fix but never received it. Each candidate was then manually verified against the current HEAD listed above.
Happy to provide anything else that would help triage — additional PoC inputs, a minimal patch following the existing safe-sibling pattern, or a written reproduction script.
Source: protocolbuffers/protobuf