Repository navigation
fix: return errors instead of UB in boolean evaluators - #413
alexskinner wants to merge 1 commit into
Conversation
boolean_not_unary_eval and the boolean binary evaluators used unreachable_unchecked on unexpected value types. Fuzzing can reach those arms when binder type checks are incomplete, so return UnsupportedUnaryOperator or Incomparable instead. Cover the NOT mismatch with a unit test and an SLT regression. Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (30.43%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #413 +/- ##
==========================================
- Coverage 93.08% 93.05% -0.03%
==========================================
Files 282 282
Lines 39885 39900 +15
==========================================
+ Hits 37125 37129 +4
- Misses 2760 2771 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
This behavior is, in fact, intentional; The accuracy of this calculation is guaranteed by BindEvaluator. Are you trying to resolve this issue because it’s causing a bug? |
|
Thanks for the explanation. That makes sense: the evaluators are the hot path and the binder is where types are checked, so I am closing this rather than adding branches there. To answer your question: it did not come from a user report, the fuzzer found it. But it is reachable with plain SQL on current main (2ce67e6, release build): So the missing check looks like it belongs in the binder rather than the evaluator, which fits your design and costs nothing at runtime. I can send a small binder-only change for |
boolean_not_unary_evaland the boolean binary evaluators usedunreachable_uncheckedon unexpected value types. Fuzzing can reach those arms when binder type checks are incomplete, so returnUnsupportedUnaryOperatororIncomparableinstead.Includes a unit test and an SLT regression (
tests/slt/boolean_type_safety.slt).