phpdave11 / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/phpdave11/gofpdf
MIT License
215 stars 43 forks source link

panic on SplitText with Arial font #26

Open kris-watts-gravwell opened 2 years ago

kris-watts-gravwell commented 2 years ago

If splittext is called with an active Arial font and the text contains an "En Dash" UTF character 8211/0x2013 there is a panic:

github.com/phpdave11/gofpdf.(*Fpdf).SplitText(0x1?, {0xc0000e0210?, 0xc0000d7090?}, 0x3ff0000000000000?)
    ~/mygo/pkg/mod/github.com/phpdave11/gofpdf@v1.4.2/splittext.go:28 +0x4c5

Looks like it doesn't check the offset on the font size slice here: https://github.com/phpdave11/gofpdf/blob/v1.4.2/splittext.go#L28