jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.29k stars 772 forks source link

Issue316 copy changes #334

Closed jacobalberty closed 4 years ago

jacobalberty commented 4 years ago

This my worsefix branch renamed, after reflecting I believe this is the correct way to fix it as it removes any side effects from the splice and assembleTables functions in utf8fontfile.go in addition I added a test TestIssue0316, if you back out the previous fix by changing all instances of ReadLikeCopy to just Read you can see the test fails, if you return them or apply this branch then the test passes.

I did go through and check for any other instances of append modifying the underlying arrays. There were a couple I thought might be an issue but once I sat down to inspect them I was able to confirm they were working only on new arrays.

jung-kurt commented 4 years ago

Many thanks, @jacobalberty -- your good thoughtful work and concise test and changes are really appreciated.