Bohdan Siryk created CASSGO-105:
-----------------------------------

             Summary: Nil pointer dereference in compileMetadata when custom 
aggregate has no final func defined
                 Key: CASSGO-105
                 URL: https://issues.apache.org/jira/browse/CASSGO-105
             Project: Apache Cassandra Go driver
          Issue Type: Bug
            Reporter: Bohdan Siryk


A nil pointer dereference occurs when a custom aggregate is defined without a 
FINALFUNC. Cassandra states that the final func is optional, so Gocql should 
correctly handle such a case.

Discovered during the implementation of CASSGO-101.

The root cause is [this piece of 
code|https://github.com/apache/cassandra-gocql-driver/blob/f1e31a58f7e0c25e58e2e2a0a0c6de358e643e8b/metadata.go#L362],
 which tries to get function metadata from the Functions map by finalFunc name. 
As there is no final function for the created aggregate, 
_AggregateMetadata.finalFunc_ is an empty string. Trying to get the function 
metadata from _KeyspaceMetadata.Functions_ map by that empty string value 
result in a return of a nil value, which is being dereferenced after.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to