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

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

So, while it might make sense to {{validateIfFixedSize}} on these fields, in 
fact they are not "fixed size" according to the storage layer.  They clearly 
_are_ fixed size, but somebody forgot to mark them as such, so that for 
purposes of this patch the validation isn't important.

But you're right that we might as well validate them too, and we could follow 
up with a simple modification.

_If we do_ then, while we're there, I also notice we have 
{{valueLengthIfFixed}} and {{validateIfFixedSize}} and we should probably 
standardise on either "fixed size" or "fixed length" rather than mixing the two 
(sorry, should have spotted that during review first time around)

> validate value sizes in LegacyLayout
> ------------------------------------
>
>                 Key: CASSANDRA-15373
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15373
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Legacy/Local Write-Read Paths
>            Reporter: Blake Eggleston
>            Assignee: Blake Eggleston
>            Priority: Normal
>             Fix For: 3.0.20, 3.11.6, 4.0
>
>
> In 2.1, all values are serialized as variable length blobs, with a length 
> prefix, followed by the actual value, even with fixed width types like int32. 
> The 3.0 storage engine, on the other hand, omits the length prefix for fixed 
> width types. Since the length of fixed width types are not validated on the 
> 3.0 write path, writing data for a fixed width type from an incorrectly sized 
> byte buffer will over or underflow the space allocated for it, corrupting the 
> remainder of that partition or indexed region from being read. This is not 
> discovered until we attempt to read the corrupted value. This patch updates 
> LegacyLayout to throw a marshal exception if it encounters an unexpected 
> value size for fixed size columns.



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