raphlinus / font-rs

Apache License 2.0
753 stars 49 forks source link

Potential wrapping add #44

Open mooman219 opened 4 years ago

mooman219 commented 4 years ago

https://github.com/raphlinus/font-rs/blob/ad0b79ea9b76cc80687ad4363d4fa692fbd0ddf8/src/raster.rs#L82

x0i can be -1 in this case, and casting it to usize will give usize max. The addition with linestart will cause an arithmetic overflow. Wrapping add should be used.