Live data from Hacker News

Wuffs: Wrangling Untrusted File Formats Safely

github.com

41–50 of 73 posts

Re: Wuffs: Wrangling Untrusted File Formats Safely

#41

Wuffs is great. I use it in Substrata ( https://substrata.info/ ) for loading PNGs. It is both faster and safer than LibPNG. It's something around 2x faster than LibPNG in my tests (depending on the PNG file), see timings here: https://github.com/google/wuffs/issues/13#issuecomment-17325... So generally Wuffs is great and you should use it to decode your PNGs. There are some downsides: not all of the obscure bit dept…

Where does the extra speed come from?

Re: Wuffs: Wrangling Untrusted File Formats Safely

#42

Earlier quoted context omitted.

I’m responding to this: > that can then be shipped like normal C, so you don't get the ecosystem friction like with ex. Rust. Emitting Rust doesn’t help with this.

it helps in the other direction: less friction to use from rust

But more friction to use from just about every other language.

Re: Wuffs: Wrangling Untrusted File Formats Safely

#43

This is one of my favorite attempts at better programming language safety, because it compiles down to C that can then be shipped like normal C, so you don't get the ecosystem friction like with ex. Rust.

What's the difference vs compiling down to machine code and linking it with your program?

Re: Wuffs: Wrangling Untrusted File Formats Safely

#45

Earlier quoted context omitted.

Frankly, I wouldn't begrudge a website for not correctly parsing an svg I composed entirely with javascript. It's annoying you can't just "flatten" or "bake" such an svg like yours into one composed entirely of elements (unless one exists?)

Often you can open the SVG in a browser and then use the developer tools to copy out the resulting nodes as "flat" SVG source code. Chrome even includes a --dump-dom flag you can use to do this on the command line, although I haven't tested it with an SVG.

Clever!

Re: Wuffs: Wrangling Untrusted File Formats Safely

#46

Does anyone know of a tool that can do this for PDFs instead?

pdfs are really really hard. the only viewer that parses them semi-correctly is ... Acrobat Reader.

try to ever read any code for PDFs and see all the horrors.

Google gave up and just bought the code from foxit.

Re: Wuffs: Wrangling Untrusted File Formats Safely

#47
post #37

Earlier quoted context omitted.

There are PDF readers that do not support the scripting format extensions. Note this does not prevent unscrupulous companies abusing dominant market positions to voluntarily embed machine and serial hash watermarks. To be clear: formats like pdf, ps, webp, svg, and tiff are so badly implemented in some ecosystems... they can't _ever_ be assumed safe input formats. Thus, at some point people need to spin up an actual…

WUFFS is provably safe - that's the whole schtick. If a WUFFS kernel exists, you can assume it is safe. If it's not proven safe, it doesn't compile. The reason everyone doesn't program in WUFFS is that you have to write a proof that your kernel is safe, which takes a very very very long time.

What's the formal verification story for WUFFS?

Re: Wuffs: Wrangling Untrusted File Formats Safely

#48
post #37

Earlier quoted context omitted.

WUFFS is provably safe - that's the whole schtick. If a WUFFS kernel exists, you can assume it is safe. If it's not proven safe, it doesn't compile. The reason everyone doesn't program in WUFFS is that you have to write a proof that your kernel is safe, which takes a very very very long time.

What's the formal verification story for WUFFS?

If you point out some of the above has run-state in some situations... it is provably nondeterministic... and thus the assertion of correctness is utter nonsense.

Hardly a panacea for fundamentally bad designs that go back decades.

Ever seen a web-server written in postscript? Its worth a look just for the laughs.

Good luck out there =)

Re: Wuffs: Wrangling Untrusted File Formats Safely

#49

Wuffs is great. I use it in Substrata ( https://substrata.info/ ) for loading PNGs. It is both faster and safer than LibPNG. It's something around 2x faster than LibPNG in my tests (depending on the PNG file), see timings here: https://github.com/google/wuffs/issues/13#issuecomment-17325... So generally Wuffs is great and you should use it to decode your PNGs. There are some downsides: not all of the obscure bit dept…

My understanding is that libpng is unoptimised and 5-10x faster is possible.

Re: Wuffs: Wrangling Untrusted File Formats Safely

#50

This is one of my favorite attempts at better programming language safety, because it compiles down to C that can then be shipped like normal C, so you don't get the ecosystem friction like with ex. Rust.

C has a lot of problems as a compilation target as well, from surprising UB (e.g. signed integer overflow) to debugging problems (e.g. #line is woefully inadequate compared to the ability to emit DWARF DIEs) to the inconvenience of setting up a toolchain for end users. To its credit, Wuffs is one of the better projects that compiles to C, because it targets a very restricted domain. But, in general, don't write programming languages that compile to C.
Post reply on HN