3 ms·
Does anyone know what the `mutable` column means? I think the cap'n'proto section may not be correct as I think you can do read/modify/write. > all the buffers
by vlovich123 5y ago
Does anyone know what the `mutable` column means? I think the cap'n'proto section may not be correct as I think you can do read/modify/write.
> all the buffers/data is trusted
This part is also wrong I think. Cap'n'proto is fine to use with untrusted data AFAIK.
> Thus, Cap’n Proto checks the structural integrity of the message just like any other serialization protocol would. And, just like any other protocol, it is up to the app to check the validity of the content.
Likely the author is referring to this section of the home page:
> As of this writing, Cap’n Proto has not undergone a security review, therefore we suggest caution when handling messages from untrusted sources
Which seems more like a disclaimer than "you can't do this" (security is on by default as compared with FlatBuffers where it's opt-in).
- kentonv 5y agoCap'n Proto is only sortof-mutable. You can update e.g. an integer in-place, but if you want to change anything that is variable-width, e.g. modifying a string, adding/removing inner objects, etc., then it can get awkward. New objects will be added to the end of the buffer, and removed objects will just be zero'd out, wasting the memory. You can "garbage-collect" by making a whole-tree copy, of course. But yeah all the stuff about untrusted data is BS. NoProto's readme lists "Safely handle untrusted data" as an advantage vs. every other format it compares against, including Protobuf and JSON. What? Every serious serialization format supports untrusted data.
- kentonv 5y agoNote that Cap'n Proto's mutability limitations are inherent to being a zero-copy protocol -- it's necessary to allocate messages in contiguous memory, tightly packed, which makes it hard to be able to allocate memory dynamically. NoProto also claims to be zero-copy, which would seem to subject it to the same issues. I couldn't find anything in the docs explaining how they avoid it.