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

Uma Maheswara Rao G commented on HBASE-3585:
--------------------------------------------

Currently in trunk, isLegalFamilyName used in below constructor and that is 
deprecated constructor.
{code}
 @Deprecated
  public HColumnDescriptor(final byte[] familyName, final int minVersions,
      final int maxVersions, final boolean keepDeletedCells,
      final String compression, final boolean encodeOnDisk,
      final String dataBlockEncoding, final boolean inMemory,
      final boolean blockCacheEnabled, final int blocksize,
      final int timeToLive, final String bloomFilter, final int scope) {
    isLegalFamilyName(familyName);
{code}

And the usable constructor is making use of this deprecated constructors 
internally. Also validated for familyName length in this usable constructor 
already.

{code}
public HColumnDescriptor(final byte [] familyName) {
    this (familyName == null || familyName.length <= 0?
      HConstants.EMPTY_BYTE_ARRAY: familyName, DEFAULT_VERSIONS,
      DEFAULT_COMPRESSION, DEFAULT_IN_MEMORY, DEFAULT_BLOCKCACHE,
      DEFAULT_TTL, DEFAULT_BLOOMFILTER);
  }
{code}

But isLegalFamilyName is marked as public and used only in HColumnDescriptor 
class.

Anyway ths simple fix couldbe to move down that validation to last constructor, 
where we are finally populating the values with setter metods.

{code}
 public HColumnDescriptor(final byte[] familyName, final int minVersions,
      final int maxVersions, final boolean keepDeletedCells,
      final String compression, final boolean encodeOnDisk,
      final String dataBlockEncoding, final boolean inMemory,
      final boolean blockCacheEnabled, final int blocksize,
      final int timeToLive, final String bloomFilter, final int scope) {
{code}


                
> isLegalFamilyName() can throw ArrayOutOfBoundException
> ------------------------------------------------------
>
>                 Key: HBASE-3585
>                 URL: https://issues.apache.org/jira/browse/HBASE-3585
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.90.1
>            Reporter: Prakash Khemani
>            Priority: Minor
>
> org.apache.hadoop.hbase.HColumnDescriptor.isLegalFamilyName(byte[]) accesses 
> byte[0] w/o first checking the array length.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to