You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Chia-Ping Tsai (JIRA)" <ji...@apache.org> on 2017/12/13 14:29:00 UTC

[jira] [Reopened] (HBASE-19484) The value array written by ExtendedCell#write is out of bounds

     [ https://issues.apache.org/jira/browse/HBASE-19484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chia-Ping Tsai reopened HBASE-19484:
------------------------------------

getValueArray() can return null so we should add the length check before writing the value array

> The value array written by ExtendedCell#write is out of bounds
> --------------------------------------------------------------
>
>                 Key: HBASE-19484
>                 URL: https://issues.apache.org/jira/browse/HBASE-19484
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Chia-Ping Tsai
>            Assignee: Chia-Ping Tsai
>            Priority: Blocker
>             Fix For: 2.0.0-beta-1
>
>         Attachments: HBASE-19484.v0.patch
>
>
> I move the impl of IndividualBytesFieldCell#write to ExtendedCell so as to make it be a default method (see HBASE-19430), but I didn't notice that the value array doesn't be handled correctly.
> {code:title=ExtendedCell}
>   default int write(OutputStream out, boolean withTags) throws IOException {
>     // Key length and then value length
>     ByteBufferUtils.putInt(out, KeyValueUtil.keyLength(this));
>     ByteBufferUtils.putInt(out, getValueLength());
>     // Key
>     PrivateCellUtil.writeFlatKey(this, out);
>     // Value
>     out.write(getValueArray());  // <-- here
>     // Tags length and tags byte array
>     if (withTags && getTagsLength() > 0) {
>       // Tags length
>       out.write((byte)(0xff & (getTagsLength() >> 8)));
>       out.write((byte)(0xff & getTagsLength()));
>       // Tags byte array
>       out.write(getTagsArray(), getTagsOffset(), getTagsLength());
>     }
>     return getSerializedSize(withTags);
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)