Android security tags, read closely by Lightrion

CVE-2024-43097 AI-generated analysis

platform/external/skia, src/core/SkRegion.cpp (RunArray run storage used by SkRegion)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (6 corrections). Verify against the commit before relying on it.

In Skia's SkRegion.cpp, RunArray::resizeToAtLeast now computes the 50% growth headroom with SkSafeMath::addInt and clamps the new element count to SK_MaxS32 on overflow, instead of letting `count += count >> 1` overflow a signed int before it is passed to realloc and stored as fCount.

Root cause

RunArray (src/core/SkRegion.cpp) is a grow-only buffer of SkRegionPriv::RunType. resizeToAtLeast(int count) added 50% headroom with `count += count >> 1` in plain int arithmetic. For a large enough requested count this addition overflows the signed int, so the value passed to fMalloc.realloc() and stored in fCount no longer reflects the requested size. operator[] checks bounds only with SkASSERT (debug builds), so release-build indexing relies on fCount being correct. The commit describes the issue as speculative, with no repro case.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to December 2024 · Findings