cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-12567) Null Dereference
Date Wed, 31 Aug 2016 08:39:21 GMT

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

Sylvain Lebresne updated CASSANDRA-12567:
-----------------------------------------
         Assignee: Sylvain Lebresne
         Reviewer: Dave Brosius
    Fix Version/s: 3.x
           Status: Patch Available  (was: Open)

There is no problem that I can see. And in 3.0 and below (the case of the code in the description),
the {{CQL3Type validator = dataType == null ? null : dataType.prepare(keyspace());}} line
is correct: {{this.validator}} can be null, but will never be for a {{ADD}} or {{ALTER}} which
are the 2 cases where {{validator}} is used (Admittedly, we could have an assert or the code
could be cleaner, but the logic isn't really complex here and those are old versions so I'm
not gonna bother).

For trunk, it's a tad uglier due to CASSANDRA-10411, which refactor things but blindly copied
the {{dataType == null ? null : dataType.prepare(keyspace())}} within the {{ADD}} and {{ALTER}}
sub-cases where it does become overly cautious. I'm attaching below a trivial cleanup of this
for trunk.

| [12567-trunk|https://github.com/pcmanus/cassandra/commits/12567-trunk] | [utests|http://cassci.datastax.com/job/pcmanus-12567-trunk-testall]
| [dtests|http://cassci.datastax.com/job/pcmanus-12567-trunk-dtest] |


> Null Dereference
> ----------------
>
>                 Key: CASSANDRA-12567
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12567
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: CQL
>            Reporter: Eduardo Aguinaga
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 3.x
>
>
> Overview:
> In May through June of 2016 a static analysis was performed on version 3.0.5 of the Cassandra
source code. The analysis included an automated analysis using HP Fortify v4.21 SCA and a
manual analysis utilizing SciTools Understand v4. The results of that analysis includes the
issue below.
> Issue:
> In the file AlterTableStatement.java on lines 139, 190 & 192, a null dereference
may occur by referencing the member validator, which can be assigned null on line 96. at the
beginning of the method announceMigration.
> {code:java}
> AlterTableStatement.java, lines 88-139:
> 088 public Event.SchemaChange announceMigration(boolean isLocalOnly) throws RequestValidationException
> 089 {
> . . .
> 096     CQL3Type validator = this.validator == null ? null : this.validator.prepare(keyspace());
> . . .
> 108     switch (oType)
> 109     {
> 110         case ADD:
> . . .
> 138 
> 139             AbstractType<?> type = validator.getType();
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message