Sven Meys created HADOOP-8853:
---------------------------------

             Summary: BytesWritable setsize unchecked
                 Key: HADOOP-8853
                 URL: https://issues.apache.org/jira/browse/HADOOP-8853
             Project: Hadoop Common
          Issue Type: Bug
          Components: io
    Affects Versions: 2.0.1-alpha
            Reporter: Sven Meys


When setting an array of length 1183230720 (in my case), the method will return 
a negative array index exception.

Cause is the following method.

public void setSize(int size) {
    if (size > getCapacity()) {
      setCapacity(size * 3 / 2);
    }
    this.size = size;
  }

size * 3 has precedence which means that for any value greater than 715.827.882 
(682,6 MB) this method is unsafe.

It would be nice to have this hidden feature documented or have a failsafe in 
place.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to