google / wuffs

Wrangling Untrusted File Formats Safely
Other
4.07k stars 127 forks source link

want to add encoding as well? #2

Open c0b opened 6 years ago

c0b commented 6 years ago

safe decoding is important however is limited, the puffs is designed elegant I admit and want to use in decoding some proprietary binary format, but to occasionally to write in such format is also a need, would you like to support encoding eventually? to make the cost of learning a different language more of worthy?

https://github.com/google/puffs/blob/master/std/gif/decode_lzw.puffs for example, would you make some code generator support encoding functions to enable write gif files in lzw compression?

danderson commented 6 years ago

Another motivating example for this: I just implemented pieces of BGP in Go for a project of mine. Since I'm speaking BGP to someone else, I need both parsing and serialization.

BGP is not the world's hardest protocol to parse. It's mostly basic types and TLV-encoded arrays. However, it's evolved over 20 years and a dozen or more RFCs, and as such has picked up a number of subtleties that tripped me up while implementing. Fuzz testing was very helpful, but there's a limited corpus of BGP pcaps out there, so I don't have much faith that my fuzzer is covering useful ground.

This seems like a good use case for puffs, but parsing alone is not that useful.

nigeltao commented 6 years ago

Yes, I absolutely want to support encoding eventually, and e.g. encoding JPEGs and PNGs are already in the doc/roadmap.md file. It just hasn't been the highest priority thing to work on so far.

Sorry if the "Parsing" name suggested otherwise. In any case, I'm probably going to change the name: https://groups.google.com/d/topic/puffslang/cSrH-s7UqwA/discussion

Dawane9729 commented 6 years ago

If I get to learn how I will soon