You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Simon Willnauer (JIRA)" <ji...@apache.org> on 2012/05/23 17:54:41 UTC

[jira] [Created] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Simon Willnauer created LUCENE-4074:
---------------------------------------

             Summary: FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
                 Key: LUCENE-4074
                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
             Project: Lucene - Java
          Issue Type: Bug
          Components: modules/spellchecker
    Affects Versions: 3.6, 4.0
            Reporter: Simon Willnauer
             Fix For: 3.6.1, 4.1


the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Updated] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer updated LUCENE-4074:
------------------------------------

    Fix Version/s:     (was: 4.1)
                   4.0
    
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0, 3.6.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Resolved] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer resolved LUCENE-4074.
-------------------------------------

    Resolution: Fixed

committed to trunk and 3.6 branch
                
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0, 3.6.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Assigned] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer reassigned LUCENE-4074:
---------------------------------------

    Assignee: Simon Willnauer
    
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.6.1, 4.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283305#comment-13283305 ] 

Simon Willnauer commented on LUCENE-4074:
-----------------------------------------

thanks jan! totally my fault! seems we dont' have jenkins testing this though :(
                
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0, 3.6.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Updated] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer updated LUCENE-4074:
------------------------------------

    Attachment: LUCENE-4074.patch

here is a patch that adds a testcase, changes all arguments and constants to 64bit signed ints and checks for negative values in the BufferSize ctor for immediate feedback.
                
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>             Fix For: 3.6.1, 4.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281833#comment-13281833 ] 

Simon Willnauer commented on LUCENE-4074:
-----------------------------------------

I will commit this soon if nobody objects.
                
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0, 3.6.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281835#comment-13281835 ] 

Robert Muir commented on LUCENE-4074:
-------------------------------------

+1, nice catch
                
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0, 3.6.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-4074) FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

Posted by "Jan Høydahl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-4074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283303#comment-13283303 ] 

Jan Høydahl commented on LUCENE-4074:
-------------------------------------

Checked in a fix in 3.6 for non-compiling TestSort.testRamBuffer. It referred to random().nextInt() instead of random.nextInt() - clear copy/paste error from Trunk code
                
> FST Sorter BufferSize causes int overflow if BufferSize > 2048MB
> ----------------------------------------------------------------
>
>                 Key: LUCENE-4074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4074
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>    Affects Versions: 3.6, 4.0
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 4.0, 3.6.1
>
>         Attachments: LUCENE-4074.patch
>
>
> the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

--
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

       

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org