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

songwanging updated CASSANDRA-14098:
------------------------------------
    Description: 
Our tool DeepTect has detected a potential integer overflow: 

Path: cassandra/src/java/org/apache/cassandra/service/StorageService.java

{code:java}
...
long totalRowCountEstimate = cfs.estimatedKeysForRange(range);
...
 int splitCount = Math.max(1, Math.min(maxSplitCount, 
(int)(totalRowCountEstimate / keysPerSplit)));
{code}

In the above code snippet, "totalRowCountEstimate" is a long variable, 
"keysPerSplit" is an integer variable. If "totalRowCountEstimate" is super 
large, directly casting "(totalRowCountEstimate / keysPerSplit" into integer 
will definitely lead to a potential integer overflow.

  was:
Our tool DeepTect has detected a potential integer overflow: 

Path: cassandra/src/java/org/apache/cassandra/service/StorageService.java

{code:java}
 int splitCount = Math.max(1, Math.min(maxSplitCount, 
(int)(totalRowCountEstimate / keysPerSplit)));
{code}

In the above code snippet, "totalRowCountEstimate" is a long variable, 
"keysPerSplit" is an integer variable. If "totalRowCountEstimate" is super 
large, directly casting "(totalRowCountEstimate / keysPerSplit" into integer 
will definitely lead to a potential integer overflow.


> Potential Integer Overflow
> --------------------------
>
>                 Key: CASSANDRA-14098
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14098
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: songwanging
>            Priority: Minor
>
> Our tool DeepTect has detected a potential integer overflow: 
> Path: cassandra/src/java/org/apache/cassandra/service/StorageService.java
> {code:java}
> ...
> long totalRowCountEstimate = cfs.estimatedKeysForRange(range);
> ...
>  int splitCount = Math.max(1, Math.min(maxSplitCount, 
> (int)(totalRowCountEstimate / keysPerSplit)));
> {code}
> In the above code snippet, "totalRowCountEstimate" is a long variable, 
> "keysPerSplit" is an integer variable. If "totalRowCountEstimate" is super 
> large, directly casting "(totalRowCountEstimate / keysPerSplit" into integer 
> will definitely lead to a potential integer overflow.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to