Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.7(EOL)
-
None
Description
Since CRC32(par, expr) and CRC32C(par, expr) presume the par part to be an already calculated CRC32 value, it has to be a 32-bit unsigned integer. However, they don't check it to be in the range, they just either truncate or roll over all other numeric values silently, without warnings or errors:
preview-10.8-MDEV-27265-misc 3d04e67d |
MariaDB [(none)]> select crc32(4294967296,''); |
+----------------------+ |
| crc32(4294967296,'') | |
+----------------------+ |
| 0 |
|
+----------------------+ |
1 row in set (0.001 sec) |
MariaDB [(none)]> select crc32(1e100,''); |
+-----------------+ |
| crc32(1e100,'') | |
+-----------------+ |
| 4294967295 |
|
+-----------------+ |
1 row in set (0.001 sec) |
MariaDB [(none)]> select crc32(10.11,''); |
+-----------------+ |
| crc32(10.11,'') | |
+-----------------+ |
| 10 |
|
+-----------------+ |
1 row in set (0.001 sec) |
MariaDB [(none)]> select crc32(-1,''); |
+--------------+ |
| crc32(-1,'') | |
+--------------+ |
| 4294967295 |
|
+--------------+ |
1 row in set (0.001 sec) |
It does however validate it to be numeric, so the behavior is at least inconsistent.
MariaDB [(none)]> select crc32('',''); |
+--------------+ |
| crc32('','') | |
+--------------+ |
| 0 |
|
+--------------+ |
1 row in set, 1 warning (0.001 sec) |
 |
MariaDB [(none)]> show warnings;
|
+---------+------+---------------------------------------+ |
| Level | Code | Message | |
+---------+------+---------------------------------------+ |
| Warning | 1292 | Truncated incorrect INTEGER value: '' | |
+---------+------+---------------------------------------+ |
1 row in set (0.000 sec) |
Attachments
Issue Links
- relates to
-
MDEV-27208 Implement 2-ary CRC32() and the CRC32C() function
- Closed
-
MDEV-28140 Unexpected error when UPDATE a NULL
- Confirmed