at git commit:
https://github.com/MariaDB/server/commit/fdc47792354c820aa4a8542d7c00d434424a63fb#diff-06426300d2671c77dd6763db8df79306R3257


instead of:
+  return n < 256 ? 1 : n < 65536 ? 2 : n < 16777216 ? 3 : 4;

use:
+  return n < 256-1 ? 1 : n < 65536-1 ? 2 : n < 16777216-1 ? 3 : 4;


since length is reduced by one: