On Mon, 23 Jan 2017, at 08:36, Kenton Varda wrote: > The prefix is a 32-bit count of segments followed by the 32-bit size of > each segment. As it turns out, any sequence of bits could in theory be a > valid prefix. That said, if expectedSizeInWordsFromPrefix() returns a > number that seems wildly large, then you can probably guess that the > prefix is invalid.
Right-o, thanks. I've been checking for implausibly big return values, but I wondered if there was anything more formal. If there can't be, that's OK. This code isn't supposed to handle arbitrary data of course, only things that are "known" to be valid messages, but I'm keen to trap my own mistakes early if possible. I did at one point bungle things and try to decode garbage. Chris -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/capnproto.
