servo / font-kit

A cross-platform font loading library written in Rust
Apache License 2.0
678 stars 100 forks source link

Add bound safety checks #186

Closed kevinyang372 closed 2 years ago

kevinyang372 commented 2 years ago

Thank you guys for making this awesome library!

I noticed that there are a couple of places in the library where corrupted / non-standard font header file could cause panicking rather than returning a parsing error. These panics are mainly caused by out of bounds errors when slicing with wrong indices. Thus, I added some bound safety checks to return a proper parsing error when these scenarios happen. This PR does not change anything functionality-wise.

jdm commented 2 years ago

@bors-servo r+ Thank you!

bors-servo commented 2 years ago

:pushpin: Commit aa33343 has been approved by jdm

bors-servo commented 2 years ago

:hourglass: Testing commit aa3334309e900c12a585c31d903129589ed8a793 with merge 589e6265fbf3677246d5abc62ab3da8a6314165c...

bors-servo commented 2 years ago

:sunny: Test successful - checks-github Approved by: jdm Pushing 589e6265fbf3677246d5abc62ab3da8a6314165c to master...