From 02cc8a5140b673f475e1d19b6a610b0a8357e806 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Mon, 27 Jun 2022 07:39:19 -0600 Subject: MDEV-27655 Fix UBSAN's Findings in Replication Tagged mysys/my_compare.c::ha_key_cmp() with attribute to ignore UBSAN runtime checks on shift operations. In particular, it is expected that this function can perform shift of greater length than the number of bits in the underlying field variables. --- mysys/my_compare.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysys/my_compare.c b/mysys/my_compare.c index ff704aa40f0..bc7da123424 100644 --- a/mysys/my_compare.c +++ b/mysys/my_compare.c @@ -117,6 +117,11 @@ static int compare_bin(const uchar *a, uint a_length, #define FCMP(A,B) ((int) (A) - (int) (B)) +/* + Suppress run-time checks in this function for overflow because it + intentionally performs integer overflow in error checking. +*/ +__attribute__((no_sanitize("shift"))) int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a, const uchar *b, uint key_length, uint32 nextflag, uint *diff_pos) -- cgit v1.2.1