Earlier quoted context omitted.
I understand that the patch is correct. The point that I am trying to make is that the correctness of this code relies on non-local reasoning (the allocation/reallocation of the table before it is used). I believe that non-local reasoning raises the chance of error (and is likely one of the reasons why this bug existed in the first place). By adding length counts and explicit bounds checks locally you provide local r…
Over a library used by billions of people a lot of times a day, those bounds checks add up to a lot of wasted time and energy if you don't strictly need them. If this is a common function in the webp library, this function is probably called something like a trillion times a day.
Google assigns a CVE for libwebp and gives it a 10.0 score
131–140 of 235 posts
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#132I'm tired and cranky today so this will lack subtlety, but: You don't have to use Rust but you **can't** use C. There's no reason to be finding these bugs in 2023; period, we can do better and we know how to do better, there's just no reason apart from legacy code (and even then) that you should be using memory unsafe languages in production.
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#133I'm tired and cranky today so this will lack subtlety, but: You don't have to use Rust but you **can't** use C. There's no reason to be finding these bugs in 2023; period, we can do better and we know how to do better, there's just no reason apart from legacy code (and even then) that you should be using memory unsafe languages in production.
Is anyone working on a Rust version?
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#134I'm tired and cranky today so this will lack subtlety, but: You don't have to use Rust but you **can't** use C. There's no reason to be finding these bugs in 2023; period, we can do better and we know how to do better, there's just no reason apart from legacy code (and even then) that you should be using memory unsafe languages in production.
(Edit: I should mention that this is one reason why I really like wuffs, mentioned elsewhere in this thread; it's a safer language that compiles down to C, so you can have mostly the best of both worlds)
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#135Earlier quoted context omitted.
This is why I'm bullish on LLMs for application security vulnerability searches (like Shodan for code). It'll see what humans don't.
Why would you expect that? LLMs are explicitly trained on what humans do. Humans miss security vulnerabilities all the time.
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#136Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#137Earlier quoted context omitted.
The best solution to this sort of bug is not using languages that are susceptible to this sort of bug. At the very least, I think it's time to retire the fallacy that we're generally capable of producing sound programs in memory unsafe languages. Just like we don't write code manually checking raw SQL to protect against injections and we don't roll our own crypto when we need to encrypt something or do a key exchange…
You do understand that's not a practical solution here, do you?
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#138I'm tired and cranky today so this will lack subtlety, but: You don't have to use Rust but you **can't** use C. There's no reason to be finding these bugs in 2023; period, we can do better and we know how to do better, there's just no reason apart from legacy code (and even then) that you should be using memory unsafe languages in production.
On this note, I was really surprised to find Red Hat's OCI runtime is written in C: https://github.com/containers/crun Is anyone working on a Rust version?
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#139Earlier quoted context omitted.
I understand that the patch is correct. The point that I am trying to make is that the correctness of this code relies on non-local reasoning (the allocation/reallocation of the table before it is used). I believe that non-local reasoning raises the chance of error (and is likely one of the reasons why this bug existed in the first place). By adding length counts and explicit bounds checks locally you provide local r…
Over a library used by billions of people a lot of times a day, those bounds checks add up to a lot of wasted time and energy if you don't strictly need them. If this is a common function in the webp library, this function is probably called something like a trillion times a day.
WebP gets a slight pass because the code is so old; WebP is at least partly based on code from On2 that extends back at least until the early '00s. Rewriting working code is always going to be lower priority than writing new code (and it's not always a safety win either; being deployed for 10 years gets you an awful lot of real-world testing!).
But look at implementations for newer image formats and you see more of the same; C and C++ with the token java implementation that won't get used outside of the JVM.
Re: Google assigns a CVE for libwebp and gives it a 10.0 score
#140Earlier quoted context omitted.
Yes, and so are Python, Lisp, Haskell, and a million other languages that were available in 2010. None of those are suitable options for an image decoding library on the range of WebP supported platforms.
Modula-2, Ada, Object Pascal, D would be. What makes them unsuitabe is lack of widespread compiler support across those platforms, if we ignore how long Ada has been available in GCC. And Modula-2 is now in GCC as well.