3 ms·
> we started looking at this protobuf library he had selected, and sure enough, the author decided it was a good idea to prepend the message with the message le
by kpw94 3y ago
> we started looking at this protobuf library he had selected, and sure enough, the author decided it was a good idea to prepend the message with the message length encoded as a varint.
> WHY? Oh, why?!
> And yes, it turns out that other people have noticed this anomaly. It's screwed up encoding and decoding in their projects, unsurprisingly. We found a (still-open) bug report from 2018, among others
If anyone knows which library/language these issues the author is talking about are in, please tell us. I'd like to avoid that library if possible
- vlovich123 3y agoI feel like I recall seeing something similar in nanopb.
- loeg 3y ago> If anyone knows which library/language these issues the author is talking about are in, please tell us. https://github.com/protobufjs/protobuf.js/issues/987 https://github.com/protobufjs/protobuf.js/issues/987 maybe (based on "And yes, that string in this post is entirely deliberate").
- simiones 3y agoThis is a bug related to decoding what the user believe is a protobuf file but actually is a length-prepended protobuf file. The article would complain about whoever wrote that file, not about the code that is reading it.
- WirelessGigabit 3y agohttps://github.com/protobufjs/protobuf.js/wiki/How-to-reverse-engineer-a-buffer-by-hand https://github.com/protobufjs/protobuf.js/wiki/How-to-revers... Prepending the message with the length means the message is length-limited. Seems standard practice here.
- gabipurcaru 3y agoyep, I think it's quite standard. The BitTorrent protocol also uses it extensively : https://wiki.theory.org/BitTorrentSpecification#Bencoding https://wiki.theory.org/BitTorrentSpecification#Bencoding
- lowbloodsugar 3y agoThat would be the official implementations of protobuf from the people that created it.