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

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

Thanks [~mallika]. Comments below:

- Thank you for adding a test!
- For the {{_mb}} fields the error messages should read 2TiB instead of GiB. 
- Instead of having separate if/else if clauses for the min and max, consider 
combining conditions (e.g. {{conf.column_index_size_in_kb <= 0 ||  
conf.column_index_size_in_kb >= 2 * 1024 * 1024}}) and making the log message 
read something like “[field] must be a positive value less than 2GiB, but was”
- Consider making {{2 * 1024 * 1024}} a constant. 


> 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
>              Labels: pull-request-available
>             Fix For: 4.0-rc
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{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