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

Benedict Elliott Smith commented on CASSANDRA-15317:
----------------------------------------------------

There was a discussion on this topic on the [mailing 
list|https://www.mail-archive.com/dev@cassandra.apache.org/msg13235.html] some 
time ago, however it was hard to build consensus on the correct semantics to 
offer.

FWIW, I agree with you, but it was contentious and I did not feel I had gained 
sufficient authority to make any changes, even for the equivalent problem on 
more recently introduced features.

> CAST AS function vulnerable to integer overflow
> -----------------------------------------------
>
>                 Key: CASSANDRA-15317
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15317
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: Avi Kivity
>            Priority: Normal
>
>  
> {noformat}
> cqlsh:ks1> create table bigdec (k decimal  primary key);
> cqlsh:ks1> insert into bigdec (k) values (100000000000000);
> cqlsh:ks1> select * from bigdec;
>  k
> -----------------
>  100000000000000
> (1 rows)
> cqlsh:ks1> select cast(k as int) from bigdec;
>  cast(k as int)
> ----------------
>       276447232{noformat}
> This overflow is unexpected for the user and can lead to incorrect results. 
> Better to refuse to execute the query.



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