[ 
https://issues.apache.org/jira/browse/HBASE-21401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16724706#comment-16724706
 ] 

Zheng Hu commented on HBASE-21401:
----------------------------------

bq. KeyValue does checks of lengths to make sure they are not insane (e.g. 
KeyValue#checkParameters). How much overlap between your check and these? Will 
we be doing double checking? Thanks.

Good question, I checked the lengths checking, such as 
KeyValue#createEmptyByteArray,  KeyValue#checkParameters ...  No overlap 
between my check and those checks, I think.  becase my sanity check only works 
when we construct an KeyValue from an complete byte[] (no other params),  we 
use this kind of constructor because we read bytes from socket or wal or hfile. 

the existed length check only works when we construct kv from the given row, 
cf, cq, ts, type and so on.  we use this because we have known the 
cf/cq/ts/type etc (not read byte stream from IO),  and construct kv to do 
further work (such as optimized seek in sever side or construct the client side 
request).  So, in theory, no overlap between them. Thanks

> Sanity check when constructing the KeyValue
> -------------------------------------------
>
>                 Key: HBASE-21401
>                 URL: https://issues.apache.org/jira/browse/HBASE-21401
>             Project: HBase
>          Issue Type: Sub-task
>          Components: regionserver
>            Reporter: Zheng Hu
>            Assignee: Zheng Hu
>            Priority: Critical
>             Fix For: 3.0.0, 2.2.0, 2.1.3, 2.0.5
>
>         Attachments: HBASE-21401.v1.patch, HBASE-21401.v2.patch, 
> HBASE-21401.v3.patch, HBASE-21401.v4.patch, HBASE-21401.v4.patch, 
> HBASE-21401.v5.patch, HBASE-21401.v6.patch, HBASE-21401.v7.patch
>
>
> In KeyValueDecoder & ByteBuffKeyValueDecoder,  we pass a byte buffer to 
> initialize the Cell without a sanity check (check each field's offset&len 
> exceed the byte buffer or not), so ArrayIndexOutOfBoundsException may happen 
> when read the cell's fields, such as HBASE-21379,  it's hard to debug this 
> kind of bug. 
> An earlier check will help to find such kind of bugs.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to