[avar] Clamp instantiated axis-value maps to F2DOT14 range (#6303)

AxisValueMap::instantiate() renormalizes the from/to coordinates and
stores them with set_float() without clamping.  With malformed input
the result can fall outside [-1,1] (e.g. 2.192 -> 35923), overflowing
the int16 F2DOT14 storage: UB under UBSan's float-cast-overflow, and a
silently truncated avar table otherwise.

Clamp both coordinates to [-1,1] before storing.  Add the reported
fuzzer input as a seed.

Reported by iceray-Li.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Behdad EsfahbodandClaude Sonnet 5.5 authored and GitHub committed 2026-09-30 18:03:28 -06:00
1 parent eb033319fc
commit b7fca823a0
2 files changed
+5

No files matched your search

+5
View File
@@ -104,6 +104,11 @@ struct AxisValueMap
from_coord = renormalizeValue ((double) from_coord, unmapped_range, triple_distances);
to_coord = renormalizeValue ((double) to_coord, axis_range, triple_distances);
/* Malformed input can renormalize outside [-1,1], which would
* overflow F2DOT14. */
from_coord = hb_clamp (from_coord, -1.f, 1.f);
to_coord = hb_clamp (to_coord, -1.f, 1.f);
coords[0].set_float (from_coord);
coords[1].set_float (to_coord);
}