You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2016/01/25 06:34:39 UTC

[jira] [Commented] (OAK-3911) Integer overflow causing incorrect file handling in OakDirectory for sile size more than 2 GB

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

Chetan Mehrotra commented on OAK-3911:
--------------------------------------

Simplified the testcase to make it more efficient and not require actually creating a 2GB file! with 1726570. Also fixed the issue in trunk with 1726232

> Integer overflow causing incorrect file handling in OakDirectory for sile size more than 2 GB
> ---------------------------------------------------------------------------------------------
>
>                 Key: OAK-3911
>                 URL: https://issues.apache.org/jira/browse/OAK-3911
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: 1.4
>
>         Attachments: OAK-3911-v1.patch
>
>
> In couple of cases we have seen strange error related to invalid seek. In such cases it was seen that file sizes are greater than 2GB. A close inspection of OakDirectory [1] shows that following calls in loadBlob and flushBlob are prone to integer overflow (Thanks [~tmueller])
> * {{int n = (int) Math.min(blobSize, length - index * blobSize);}}
> * {{int n = (int) Math.min(blobSize, length - i * blobSize);}}
> Above both {{blobSize}} and {{index}} and {{i}} are {{int}}. And multiplication of 2 int would be int that can cause overflow.
> {noformat}Caused by: java.io.IOException: Invalid seek request
> 	at org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexFile.seek(OakDirectory.java:288)
> 	at org.apache.jackrabbit.oak.plugins.index.lucene.OakDirectory$OakIndexInput.seek(OakDirectory.java:418)
> 	at org.apache.lucene.codecs.BlockTreeTermsReader.seekDir(BlockTreeTermsReader.java:223)
> 	at org.apache.lucene.codecs.BlockTreeTermsReader.<init>(BlockTreeTermsReader.java:142)
> {noformat}
> [1] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/OakDirectory.java#L361



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)