Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-28101

Should check the return value of protobuf Message.mergeDelimitedFrom

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      Found this problem while upgrading thirdparty dependencies.

      The javadoc of mergeDelimitedFrom says

          /**
           * 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
           */
      

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

      Attachments

        Issue Links

          Activity

            People

              zhangduo Duo Zhang
              zhangduo Duo Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: