hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uma Maheswara Rao G (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-3585) isLegalFamilyName() can throw ArrayOutOfBoundException
Date Mon, 16 Apr 2012 08:58:19 GMT

    [ 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

        

Mime
View raw message