[ https://issues.apache.org/jira/browse/HBASE-21401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16699997#comment-16699997 ]
Zheng Hu commented on HBASE-21401: ---------------------------------- bq. Could the validity checks be done inline as we construct the KeyValue or the NoTagsKeyValue instead? Thanks. The current patch will validate the bytes when deserialize from socket or from WAL.. but the HFIleReaderImpl won't use the KeyValueUtil.createKeyValueFromInputStream to construte the KeyValue, so it will escape the check. I think it's OK to move the validating when we construct the KeyValue if the JMH method testing (exclude the impact from JIT) also says the checkKeyValueBytes won't cost too much time, I'll update the JMH test result in HBASE-21459. Thanks. > Sanity check in BaseDecoder#parseCell > ------------------------------------- > > 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.0.3, 2.1.2 > > 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 > > > 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)