diff --git a/src/hb-repacker.hh b/src/hb-repacker.hh index 295dc6415..2cfff9b29 100644 --- a/src/hb-repacker.hh +++ b/src/hb-repacker.hh @@ -75,7 +75,8 @@ struct graph_t // setting distance = 0 which will force to sort immediately after // it's parent where possible. - int64_t modified_distance = distance + distance_modifier (); + int64_t modified_distance = + hb_min (hb_max(distance + distance_modifier (), 0), 0x7FFFFFFFFF); return (modified_distance << 24) | (0x00FFFFFF & order); } diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-4961171477233664 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-4961171477233664 new file mode 100644 index 000000000..013a85943 Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-4961171477233664 differ