Skip to content

Commit

Permalink
[avar] Fix out-of-bound read when input is bigger than all the coords
Browse files Browse the repository at this point in the history
'i' shouldn't become equal to array's length which as the increament
is happened at end of the loop, if the input is bigger than all the
table coords, it will be equal to array's length.

Fixes https://crbug.com/oss-fuzz/21092
  • Loading branch information
ebraminio committed Mar 7, 2020
1 parent 6924e29 commit 0d729b4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hb-ot-var-avar-table.hh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct SegmentMaps : ArrayOf<AxisValueMap>
return value - arrayZ[0].fromCoord + arrayZ[0].toCoord;

unsigned int i;
unsigned int count = len;
unsigned int count = len - 1;
for (i = 1; i < count && value > arrayZ[i].fromCoord; i++)
;

Expand Down
Binary file not shown.

0 comments on commit 0d729b4

Please sign in to comment.