diff --git a/freetype/truetype/hint.go b/freetype/truetype/hint.go index 35f1fc5e4ece4d99771ab318cd31d70c5a833bb0..26c631436d69c2b1798d4299672a5978ae59ff74 100644 --- a/freetype/truetype/hint.go +++ b/freetype/truetype/hint.go @@ -668,7 +668,7 @@ func (h *hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, if ref == nil || p == nil { return errors.New("truetype: hinting: point out of range") } - curDist := dotProduct(f26dot6(p.X-ref.X), f26dot6(p.Y-ref.Y), h.gs.dv) + curDist := dotProduct(f26dot6(p.X-ref.X), f26dot6(p.Y-ref.Y), h.gs.pv) // Set-RP0 bit. if opcode == opMSIRP1 { @@ -1343,8 +1343,8 @@ func (h *hinter) run(program []byte, pCurrent, pUnhinted, pInFontUnits []Point, h.initializeScaledCVT() } top-- - n := f26dot6(h.stack[top]) - if top < 2*int(h.gs.loop) { + n := h.stack[top] + if int32(top) < 2*n { return errors.New("truetype: hinting: stack underflow") } for ; n > 0; n-- {