]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add assertion
authorAlan T. DeKok <aland@freeradius.org>
Thu, 25 Nov 2021 16:53:49 +0000 (11:53 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 25 Nov 2021 16:53:49 +0000 (11:53 -0500)
src/lib/util/calc.c

index 9143676ea529b8f2a478b136f3e0d5df0da8364d..6e7a5cb8d1f83af0b5b3468aaf296f17306b5630 100644 (file)
@@ -1146,9 +1146,16 @@ int fr_value_calc_binary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t hint
                         *      so that we can take (for example)
                         *      uint8 + uint16, and have the output as
                         *      uint16.
+                        *
+                        *      There must be only one entry per [a,b]
+                        *      pairing.  That way we're sure that [a,b]==[b,a]
                         */
                        hint = upcast[a->type][b->type];
-                       if (hint == FR_TYPE_NULL) hint = upcast[b->type][a->type];
+                       if (hint == FR_TYPE_NULL) {
+                               hint = upcast[b->type][a->type];
+                       } else {
+                               fr_assert(upcast[b->type][a->type] == FR_TYPE_NULL);
+                       }
 
                        if (hint != FR_TYPE_NULL) {
                                break;