mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
[kerx] Saturate attachment coordinates
AAT kerx format 4 derives mark offsets by subtracting callback or scaled anchor coordinates. Saturate each coordinate difference so extreme origins and public font scales cannot overflow. This is part of the complete position-overflow fix for issue #6151. Testing: meson test -C build --print-errorlogs Assisted-by: Codex <codex@openai.com>
This commit is contained in:
1 parent
d8927d1b18
commit
b2bd10211d
1 file changed
+8
-6
@@ -584,8 +584,8 @@ struct KerxSubTableFormat4
|
||||
&currX, &currY))
|
||||
return;
|
||||
|
||||
o.x_offset = markX - currX;
|
||||
o.y_offset = markY - currY;
|
||||
o.x_offset = hb_saturate_sub (markX, currX);
|
||||
o.y_offset = hb_saturate_sub (markY, currY);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -606,8 +606,10 @@ struct KerxSubTableFormat4
|
||||
currAnchorPoint,
|
||||
c->sanitizer.get_num_glyphs ());
|
||||
|
||||
o.x_offset = c->font->em_scale_x (markAnchor.xCoordinate) - c->font->em_scale_x (currAnchor.xCoordinate);
|
||||
o.y_offset = c->font->em_scale_y (markAnchor.yCoordinate) - c->font->em_scale_y (currAnchor.yCoordinate);
|
||||
o.x_offset = hb_saturate_sub (c->font->em_scale_x (markAnchor.xCoordinate),
|
||||
c->font->em_scale_x (currAnchor.xCoordinate));
|
||||
o.y_offset = hb_saturate_sub (c->font->em_scale_y (markAnchor.yCoordinate),
|
||||
c->font->em_scale_y (currAnchor.yCoordinate));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -623,8 +625,8 @@ struct KerxSubTableFormat4
|
||||
int currX = *data++;
|
||||
int currY = *data++;
|
||||
|
||||
o.x_offset = c->font->em_scale_x (markX) - c->font->em_scale_x (currX);
|
||||
o.y_offset = c->font->em_scale_y (markY) - c->font->em_scale_y (currY);
|
||||
o.x_offset = hb_saturate_sub (c->font->em_scale_x (markX), c->font->em_scale_x (currX));
|
||||
o.y_offset = hb_saturate_sub (c->font->em_scale_y (markY), c->font->em_scale_y (currY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user