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

Jordan West commented on CASSANDRA-15470:
-----------------------------------------

[~mallika] that seems like a reasonable range. When {{input}} is KiB thats 2Tib 
which is extremely large for any of those values. I agree the validation would 
be beneficial in the setters since some of them can be changed by operators at 
runtime (or may be made to do so in the future) or tests.

 

I would recommend *not* performing additional validation in the getters. The 
reasons for doing the getter validation you noted are correct but the getters 
may be used in a code hot path where minimal work is desired. Looking at the 
code {{getRawConfig()}} is only used for testing (and perhaps should be marked 
as {{@VisibleForTesting}}

> Potential Overflow in DatabaseDescriptor Functions That Convert Between KB/MB 
> & Bytes
> -------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15470
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15470
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Local/Config
>            Reporter: Jordan West
>            Assignee: Mallika Kulkarni
>            Priority: Normal
>             Fix For: 4.0-rc
>
>
> {{DatabaseDescriptor}} has several functions that convert between user 
> supplied sizes in KB/MB and bytes. These are implemented without much 
> consistency and, while unlikely, several have the potential to overflow since 
> validation on the input is missing. Meanwhile, some widen the number to a 
> long correctly. Options include: widening in all places or simply doing 
> better validation on start up — currently only the lower bound of the valid 
> range is checked for many of these fields.
> List of Affected {{DatabaseDescriptor}} Methods:
>  * {{getColumnIndexSize}}
>  * {{getColumnIndexCacheSize}}
>  * {{getBatchSizeWarnThreshold}}
>  * {{getNativeTransportFrameBlockSize}}
>  * {{getRepairSessionSpaceInMegabytes}}
>  * {{getNativeTransportMaxFrameSize}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to