News for hackers. Stuff that matters.
Re:Google assigns a CVE for libwebp and gives it a 10.0 score by pornel on Tuesday September 26, 2023 @01:43PM (#37662994)
> If we were to hypothesize a counterfactual world where webp was written in rust

You don't have to hypothesize. It's here:

https://github.com/image-rs/image/blob/master/src/codecs/web...

and it doesn't use unsafe indexing.

Re:Google assigns a CVE for libwebp and gives it a 10.0 score by ninkendo on Tuesday September 26, 2023 @03:26PM (#37664609)
That’s not google’s webp library, that’s a totally different project. It doesn’t really matter what that project does.
Re:Google assigns a CVE for libwebp and gives it a 10.0 score by pornel on Tuesday September 26, 2023 @04:36PM (#37665488)
You’re arguing about a potential vulnerability in a hypothetical code that exists only in your imagination.

Meanwhile the real code that exists doesn’t work like that. It’s not just a matter of personal style. Rust has constructs that help avoid bounds checks. It has design patterns that move unsafe code into smaller, easier to verify helpers. It has a culture of caring about safety – people don’t rewrite projects in Rust to just give up on its biggest selling point.

Re:Google assigns a CVE for libwebp and gives it a 10.0 score by ninkendo on Tuesday September 26, 2023 @05:36PM (#37666111)
We know that the webp project does use unchecked access. We know this is intentional because they go through a lot of effort to do up front bounds checking rather than at every access. We also know that companies like Dropbox, when implementing their own Huffman table implementation, demonstrated an 11% speed up when disabling bounds checks: https://dropbox.tech/infrastructure/lossless-compression-wit...

It is not a stretch whatsoever to assume that a direct rewrite of the webp library into rust would have uncovered the same perf findings that Dropbox did, and decided that the pattern of “up front bounds checks, disabled bounds checks at element access” is a reasonable perf enhancement, especially for a Huffman table, where you’re continually accessing the compression table over and over when expanding it.