Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
13.1
-
None
-
Not for Release Notes
Description
An independent defect (NOT caused by the collation-sortkey root cause above — re-verified during audit: the empty string returns 0 under every collation, so the collation path is not involved). CONV(XXH3(''),10,16) returns 0 while the official xxHash vectors are XXH3_64bits("") = 0x2D06800538D394C2 and XXH32("") = 0x02CC5D05. Consequences: (a) values computed by any standard xxHash implementation (C/Python/xxhash CLI) never match MariaDB's, making the function unusable for cross-system hash verification; (b) the empty string and NULL are indistinguishable (both yield 0). Requires a separate fix from M11/M12 (likely an empty-input short-circuit or finalization bug in the Hasher wrapper).
SELECT CONV(XXH3(''), 10, 16); -- 0 official XXH3_64bits("") = 0x2D06800538D394C2 |
SELECT CONV(XXH32(''), 10, 16); -- 0 official XXH32("") = 0x02CC5D05 |
AI suggests fix:
Change val_int() to byte semantics, same as Item_func_md5:
String *res= args[0]->val_str(&buffer);
if (!res)
hasher.update(res->ptr(), res->length());
Also add regression tests from the official xxHash vectors (empty string / single byte / known vectors).