From: Alan T. DeKok Date: Thu, 25 Nov 2021 16:53:49 +0000 (-0500) Subject: add assertion X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf0ae6a88635710be39ff260247543d56c97b644;p=thirdparty%2Ffreeradius-server.git add assertion --- diff --git a/src/lib/util/calc.c b/src/lib/util/calc.c index 9143676ea52..6e7a5cb8d1f 100644 --- a/src/lib/util/calc.c +++ b/src/lib/util/calc.c @@ -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;