diff options
author | Monty <monty@mariadb.org> | 2022-04-11 17:30:28 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2022-04-11 17:30:28 +0300 |
commit | 6891c4874a70685e6f6661fad2369d26007003c7 (patch) | |
tree | fc67fa78c271359fc7edbc5621b8f0cf835cc4c0 /storage | |
parent | 2ae92e89817b1eceed134fcf98e21f99ce26a22d (diff) | |
download | mariadb-git-6891c4874a70685e6f6661fad2369d26007003c7.tar.gz |
MDEV-28269 Assertion `save_errno' in maria_write or ER_GET_ERRNO
The issue was that the value of MARIA_FOUND_WRONG_KEY was a value
that could be returned by ha_key_cmp.
This was already fixed in MyISAM, now using the same fix in Aria:
Setting the value to INT_MAX32, which should be impossible in any
normal cases.
I also fixed so that if there is a wrong key, we now get a proper error
message and not an assert.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/maria/ma_write.c | 3 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index 57758e8adae..33097e9ee2f 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -728,7 +728,10 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key, } } if (flag == MARIA_FOUND_WRONG_KEY) + { + my_errno= HA_ERR_CRASHED; goto err; + } if (!was_last_key) insert_last=0; next_page= _ma_kpos(page.node, keypos); diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 919dc831c75..382e3cbe2ba 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -887,7 +887,8 @@ struct st_maria_handler #define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */ #define PACK_TYPE_SPACE_FIELDS 2U #define PACK_TYPE_ZERO_FILL 4U -#define MARIA_FOUND_WRONG_KEY 32768U /* Impossible value from ha_key_cmp */ + +#define MARIA_FOUND_WRONG_KEY INT_MAX32 /* Impossible value from ha_key_cmp */ #define MARIA_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size)) #define MARIA_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */ |