I would guess that there is a problem on the serialization side. Any of the
WithCachedSizes serialization methods rely on the cached sizes, which means
that you need to have called ByteSizeLong() or ByteSize() right before
serializing. If the cached sizes are stale then things will most likely not
work correctly.

On Fri, Aug 6, 2021 at 11:45 PM yangyi...@gmail.com <yangyihao1...@gmail.com>
wrote:

> Hi folks.
>
> We are using c++ protocol buffer v3.0.2 for some structures' serialization
> and deserialization.
> We are able to serialize a large PB message (~ 600MB) to a buffer and
> verfied the serialized size equals to PB.ByteSize().
> Then when we try to deserialize the buffer back to the PB message. We are
> expecting the deserialization fails. But randomly, sometimes we see the
> deserialization succeeds, but the deserialized PB message only has a
> partial content with a ByteSize() == 64MB.
>
> We wonder if there is anyone encountered this issue before. We would like
> to have a consistent behavior that all deserialization should fail (not
> succeed but return some wrong result).
>
> serialization function we use: *SerializeWithCachedSizesToArray(uint8 *
> target) const*
> deserialization function we use: *ParseFromArray(const void * data, int
> size).*
>
> PB structure:
> *message response*
> *{*
> *    message A*
> *    {*
> *         required uint64 a = 1;*
> *         repeated uint64 b = 2;*
> *    }*
> *    repeated A c = 1;*
> *}*
>
> Thanks,
> Yihao
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/ed13812d-d115-4c10-a3a6-d07066698050n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/ed13812d-d115-4c10-a3a6-d07066698050n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr5hsqNtZnbnjoWGwfOhj-NFhw3bcmNAxROMStBX_AxHtA%40mail.gmail.com.

Reply via email to