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

MultiByteBuff#getXXX() has issues

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Minor
    • Resolution: Unresolved
    • 2.0.0
    • None
    • None
    • None

    Description

      MBB#getInt() - the relative getXXX() API has issues.

      int remaining = this.curItem.remaining();
          if (remaining >= Bytes.SIZEOF_INT) {
            return this.curItem.getInt();
          }
          if (remaining == 0) {
            if (items.length - 1 == this.curItemIndex) {
              // means cur item is the last one and we wont be able to read a long. Throw exception
              throw new BufferUnderflowException();
            }
            this.curItemIndex++;
            this.curItem = this.items[this.curItemIndex];
            return this.curItem.getInt();
          }
      

      Now here if the curItem does not have anything remaining in it we just go to the nextItem and from that we do a getInt. But we don't check if that item is big enough to return an int. This may not happen in most of the real cases but as an API it should handle that case. Since MBB are now used in the RpcServer#response there could be some on demand BB created that are smaller in sizes and it could lead to issues.

      Attachments

        1. HBASE-17258.patch
          3 kB
          ramkrishna.s.vasudevan

        Activity

          People

            ram_krish ramkrishna.s.vasudevan
            ram_krish ramkrishna.s.vasudevan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: