Yang writes:

> currently Protocol Buffer parser moves down to the stream until it reaches end
> of buffer,
>
> but hadoop currently has a bug (       https://issues.apache.org/jira/browse/
> MAPREDUCE-1487          ) that presents a buffer larger than the actual 
> message
> to PB parser,
> so PB parses some junk, and fails.
>
> right now the only hack I have against this is to add an end-of-record tag to
> PB, so that the parser also recognizes this in addition to buffer.
>
>
> I think this could be a good idea since we proactively guard against  unsafe
> situations like the above.

Why not use something like the existing Java methods writeDelimitedTo()
and parseDelimitedFrom() to add the correct length in front of the
message?  (This is also one of the most preferred ways to store multiple
messages into a stream.  These methods currently only exist in Java, but
the same approach is straightforward to implement in C++ with
CodedInputStream::PushLimit, and I would guess that Python also gives
you a way to do it.)

Michael Poole

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to