summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-06-27 07:39:19 -0600
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-06-27 07:39:35 -0600
commit02cc8a5140b673f475e1d19b6a610b0a8357e806 (patch)
tree00812cd350a8287409af14dc2f4ec8020971ce9a
parent57312cc9fd6f77d71d79b9c7614a057522689a6e (diff)
downloadmariadb-git-10.2-MDEV-27355-rpl-ubsan.tar.gz
MDEV-27655 Fix UBSAN's Findings in Replication10.2-MDEV-27355-rpl-ubsan
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.
-rw-r--r--mysys/my_compare.c5
1 files changed, 5 insertions, 0 deletions
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)