Changeset: 21c380a5e43a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/21c380a5e43a
Modified Files:
        gdk/gdk_select.c
Branch: Jul2021
Log Message:

Fix crash if virtualize argument is NULL.


diffs (34 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -32,21 +32,22 @@ BAT *
 virtualize(BAT *bn)
 {
        /* input must be a valid candidate list or NULL */
-       if(bn && ((bn->ttype != TYPE_void && bn->ttype != TYPE_oid) || 
!bn->tkey || !bn->tsorted)) {
+       if (bn == NULL)
+               return NULL;
+       if ((bn->ttype != TYPE_void && bn->ttype != TYPE_oid) || !bn->tkey || 
!bn->tsorted) {
                fprintf(stderr, "#bn type %d nil %d key %d sorted %d\n",
-                               bn->ttype, is_oid_nil(bn->tseqbase),
-                               bn->tkey, bn->tsorted);
+                       bn->ttype, is_oid_nil(bn->tseqbase),
+                       bn->tkey, bn->tsorted);
                fflush(stderr);
        }
-       assert(bn == NULL ||
-              (((bn->ttype == TYPE_void && !is_oid_nil(bn->tseqbase)) ||
-                bn->ttype == TYPE_oid) &&
-               bn->tkey && bn->tsorted));
+       assert(((bn->ttype == TYPE_void && !is_oid_nil(bn->tseqbase)) ||
+               bn->ttype == TYPE_oid) &&
+              bn->tkey && bn->tsorted);
        assert(BBP_refs(bn->batCacheid) == 1);
        assert(BBP_lrefs(bn->batCacheid) == 0);
        /* since bn has unique and strictly ascending values, we can
         * easily check whether the column is dense */
-       if (bn && bn->ttype == TYPE_oid &&
+       if (bn->ttype == TYPE_oid &&
            (BATcount(bn) <= 1 ||
             * (const oid *) Tloc(bn, 0) + BATcount(bn) - 1 ==
             * (const oid *) Tloc(bn, BUNlast(bn) - 1))) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to