Android security tags, read closely by Lightrion

CVE-2025-64505 AI-generated analysis

platform/external/libpng, read transformations (pngrtran.c, png_set_quantize / png_do_quantize)

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.

libpng png_set_quantize now allocates and identity-initialises the quantize_index lookup table to PNG_MAX_PALETTE_LENGTH (256) bytes instead of num_palette bytes, so out-of-range palette indices from a malformed PNG no longer read past the table in png_do_quantize; a companion commit frees the previous quantize_index before reallocating and makes quantize_sort a local variable to stop leaks on repeated calls.

Root cause

In pngrtran.c png_set_quantize, when full_quantize == 0, the lookup table png_ptr->quantize_index was allocated with only num_palette bytes and filled for i < num_palette. According to the commit message, the pixel processing path in png_do_quantize indexes this table with palette indices from the image data and does no runtime bounds check. A malformed PNG whose indices are >= num_palette therefore causes reads past the end of the allocation. Separately, per the leak-fix commit message, png_set_quantize overwrote png_ptr->quantize_index without freeing the earlier allocation, so memory leaked when an application called the function more than once on the same png_struct (the message also mentions quantize_sort).

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to June 2026 · Findings