68 points · by Bender · 3y ago · 35 comments
I guess there's a trade-off between reinventing the wheel vs. being open to 0-days that take down a lot of projects at a time.
The upside is of the current situation is that it will likely be patched more quickly than a smaller project would be able to since everyone will be looking at libvpx right now. One shared library update will fix a lot of programs, though if they use snap or flatpack or statically include it then it will be more of a mess.
Many applications present images from untrusted sources. I'm having a hard time thinking of a single application that will _encode_ untrusted input, beyond a browser.
It's _not_ a vulnerability that needs to be mentioned alongside the webp cve lest the public be caught unaware of something they need to update on every phone and laptop they own.
I have come to think about it more as comparative advantage of different programmers and their training / skill set. Not everyone has the skills to write a complex state machine for stream encoding (I haven’t read up on libvpx, so forgive me if I mischaracterized it). We shouldn’t expect a huge diversity of available libraries to do this task.
But we should have more tools to inform the consumer of libraries to see their risk from any individual library and there should be more transparency about alternatives/substitutes to make sure we don’t see a monoculture around an inferior library if a superior option exists.
We should expect specialists to write specialized code. But we should also have QA specialists (and hopefully lots of automation) review the code. And the more systems a library is installed on, the more verification/scrutiny should be put on that code. This is the strategy of Project Zero (Google’s 0day hunting project) and lots of other organizations should contribute similar efforts.
window.MediaStreamTrack = undefined
window.RTCPeerConnection = undefined
window.RTCSessionDescription = undefined
window.webkitMediaStreamTrack = undefined
window.webkitRTCPeerConnection = undefined
window.webkitRTCSessionDescription = undefinedIs there something inaccurate or naive in this paragraph?
Even the way to write C is not the same as 10 years ago.
But habits are hard to change. Forcing a change by changing the language is effective. Also, having languages that do more checks is also an option, but has performance impacts.
In the end, the weakest link is always the coder. Much more nowadays as they are asked to emit feature faster and faster.
It's just that there is a lot of legacy code, and the migration to languages like Rust will take a long time.
Codecs have a lot of "glue" code handling configuration, I/O, and other stuff besides their most performance sensitive bit-pushing loops.
But this safe-or-fast dilemma has been mostly solved with Rust (and Wuffs). I am writing codecs in Rust.
Rust has many zero-cost abstractions (high level wrappers that get inlined, and compiled for specific types and values you use them with, and it gets optimized as concrete low-level code). This allows writing a lot performance-sensitive code using safe Rust. For example, you don't get redundant bounds checks if you use iterators, and despite being high-level abstraction with chains of iterators and closures, they compile to simple loops, and may even get vectorized (even more so than C, thanks to Rust's stronger no-aliasing and immutability guarantees).
When you need something more adventurous, you can dress it in a safe (compiler-verified) higher-level abstraction on top of minimal amount of unsafe code. Even though the underlying unsafe code is as unsafe as C, making a small component out of it helps to review/test/fuzz it in isolation against its interface, rather than test it as part of a complex algorithm.
What we are missing is that most people still don't do it as frequently as in other industries.