You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Russell A Brown (JIRA)" <ji...@apache.org> on 2019/03/11 18:00:00 UTC

[jira] [Updated] (LUCENE-8720) Integer overflow bug in NameIntCacheLRU.makeRoomLRU()

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

Russell A Brown updated LUCENE-8720:
------------------------------------
    Description: 
The NameIntCacheLRU.makeRoomLRU() method has an integer overflow bug because if maxCacheSize >= Integer.MAX_VALUE/2, 2*maxCacheSize will overflow to -65536 and the value of n will be negative, which will prevent any clearing of the cache whatsoever.

Moreover, comments in NameIntCacheLRU.java and LruTaxonomyWriterCache.java indicate that 2/3 of the cache will be cleared, whereas in fact only 1/3 of the cache is cleared. So as not to change the behavior of the NameIntCacheLRU.makeRoomLRU() method, I have not changed the code to clear 2/3 of the cache but instead I have changed the comments to indicate that 1/3 of the cache is cleared.

  was:
The NameIntCacheLRU.makeRoomLRU() method has an integer overflow bug because if maxCacheSize >= Integer.MAX_VALUE, 2*maxCacheSize will overflow to -65536 and the value of n will be negative, which will prevent any clearing of the cache whatsoever.

Moreover, comments in NameIntCacheLRU.java and LruTaxonomyWriterCache.java indicate that 2/3 of the cache will be cleared, whereas in fact only 1/3 of the cache is cleared. So as not to change the behavior of the NameIntCacheLRU.makeRoomLRU() method, I have not changed the code to clear 2/3 of the cache but instead I have changed the comments to indicate that 1/3 of the cache is cleared.


> Integer overflow bug in NameIntCacheLRU.makeRoomLRU()
> -----------------------------------------------------
>
>                 Key: LUCENE-8720
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8720
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/search
>    Affects Versions: 7.7.1
>         Environment: Mac OS X 10.11.6 but this bug is not affected by the environment because it is a straightforward integer overflow bug.
>            Reporter: Russell A Brown
>            Priority: Major
>              Labels: easyfix, patch
>             Fix For: 7.1.1
>
>         Attachments: LUCENE-NNNN.patch
>
>
> The NameIntCacheLRU.makeRoomLRU() method has an integer overflow bug because if maxCacheSize >= Integer.MAX_VALUE/2, 2*maxCacheSize will overflow to -65536 and the value of n will be negative, which will prevent any clearing of the cache whatsoever.
> Moreover, comments in NameIntCacheLRU.java and LruTaxonomyWriterCache.java indicate that 2/3 of the cache will be cleared, whereas in fact only 1/3 of the cache is cleared. So as not to change the behavior of the NameIntCacheLRU.makeRoomLRU() method, I have not changed the code to clear 2/3 of the cache but instead I have changed the comments to indicate that 1/3 of the cache is cleared.



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

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