You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Duo Zhang (Jira)" <ji...@apache.org> on 2023/09/20 07:05:00 UTC

[jira] [Created] (HBASE-28101) Should check the return value of protobuf Message.mergeDelimitedFrom

Duo Zhang created HBASE-28101:
---------------------------------

             Summary: Should check the return value of protobuf Message.mergeDelimitedFrom
                 Key: HBASE-28101
                 URL: https://issues.apache.org/jira/browse/HBASE-28101
             Project: HBase
          Issue Type: Bug
          Components: Protobufs, rpc
            Reporter: Duo Zhang
             Fix For: 2.6.0, 2.4.18, 2.5.6, 3.0.0-beta-1


Found this problem while upgrading thirdparty dependencies.

The javadoc of mergeDelimitedFrom says

{code}
    /**
     * Like {@link #mergeFrom(InputStream)}, but does not read until EOF. Instead, the size of the
     * message (encoded as a varint) is read first, then the message data. Use {@link
     * MessageLite#writeDelimitedTo(OutputStream)} to write messages in this format.
     *
     * @return true if successful, or false if the stream is at EOF when the method starts. Any
     *     other error (including reaching EOF during parsing) causes an exception to be thrown.
     * @throws InvalidProtocolBufferException the bytes read are not syntactically correct
     *     according to the protobuf wire format specification. The data is corrupt, incomplete,
     *     or was never a protobuf in the first place.
     * @throws IOException an I/O error reading from the stream
     */
{code}

So we should not ignore the return value, otherwise we may get an incomplete message.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)