Code

analyzer: Check the data-type of IN operands.
authorSebastian Harl <sh@tokkee.org>
Sun, 1 Mar 2015 15:19:29 +0000 (16:19 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 1 Mar 2015 15:19:29 +0000 (16:19 +0100)
src/frontend/analyzer.c

index 75aa94d1579da92f8f9e25b3ee03c74273d70b74..e9e1d138c80c9bd5177caa7f4d38b02f30a173b3 100644 (file)
@@ -268,6 +268,16 @@ analyze_matcher(int context, sdb_store_matcher_t *m, sdb_strbuf_t *errbuf)
                                                CMP_M(m)->right->data_type);
                                return -1;
                        }
+
+                       if ((CMP_M(m)->left->data_type > 0)
+                                       && (CMP_M(m)->right->data_type > 0)) {
+                               if ((CMP_M(m)->left->data_type & 0xff)
+                                               != (CMP_M(m)->right->data_type & 0xff)) {
+                                       cmp_error(errbuf, m->type, CMP_M(m)->left->data_type,
+                                                       CMP_M(m)->right->data_type);
+                                       return -1;
+                               }
+                       }
                        break;
 
                case MATCHER_REGEX: