You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "David Capwell (Jira)" <ji...@apache.org> on 2020/05/05 18:39:00 UTC

[jira] [Updated] (CASSANDRA-15790) EmptyType doesn't override writeValue so could attempt to write bytes when expected not to

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

David Capwell updated CASSANDRA-15790:
--------------------------------------
     Bug Category: Parent values: Correctness(12982)Level 1 values: Unrecoverable Corruption / Loss(13161)
       Complexity: Low Hanging Fruit
    Discovered By: User Report
         Severity: Normal
           Status: Open  (was: Triage Needed)

> EmptyType doesn't override writeValue so could attempt to write bytes when expected not to
> ------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15790
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15790
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics
>            Reporter: David Capwell
>            Assignee: David Capwell
>            Priority: Normal
>
> EmptyType.writeValues is defined here https://github.com/apache/cassandra/blob/e394dc0bb32f612a476269010930c617dd1ed3cb/src/java/org/apache/cassandra/db/marshal/AbstractType.java#L407-L414
> {code}
> public void writeValue(ByteBuffer value, DataOutputPlus out) throws IOException
>     {
>         assert value.hasRemaining();
>         if (valueLengthIfFixed() >= 0)
>             out.write(value);
>         else
>             ByteBufferUtil.writeWithVIntLength(value, out);
>     }
> {code}
> This is fine when the value is empty as the write of empty no-ops (the readValue also noops since the length is 0), but if the value is not empty (possible during upgrades or random bugs) then this could silently cause corruption; ideally this should throw a exception if the ByteBuffer has data.



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

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