[ 
https://issues.apache.org/jira/browse/HIVE-21371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gopal V updated HIVE-21371:
---------------------------
       Resolution: Fixed
    Fix Version/s: 4.0.0
           Status: Resolved  (was: Patch Available)

Pushed to master, thanks [~belugabehr]

> Make NonSyncByteArrayOutputStream Overflow Conscious 
> -----------------------------------------------------
>
>                 Key: HIVE-21371
>                 URL: https://issues.apache.org/jira/browse/HIVE-21371
>             Project: Hive
>          Issue Type: Improvement
>    Affects Versions: 4.0.0, 3.2.0
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>             Fix For: 4.0.0
>
>         Attachments: HIVE-21371.1.patch, HIVE-21371.2.patch, 
> HIVE-21371.2.patch, HIVE-21371.2.patch
>
>
> {code:java|title=NonSyncByteArrayOutputStream}
>   private int enLargeBuffer(int increment) {
>     int temp = count + increment;
>     int newLen = temp;
>     if (temp > buf.length) {
>       if ((buf.length << 1) > temp) {
>         newLen = buf.length << 1;
>       }
>       byte newbuf[] = new byte[newLen];
>       System.arraycopy(buf, 0, newbuf, 0, count);
>       buf = newbuf;
>     }
>     return newLen;
>   }
> {code}
> This will fail if the array is 2GB or larger because it will double the size 
> every time without consideration for the 4GB limit on arrays.



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

Reply via email to