Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6569

CAST(binary AS CHAR(N)) can create a malformed result

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.3.12, 5.5.39, 10.0.13
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:
      None

      Description

      CAST from BINARY to CHAR does not check wel-formedness:

      MariaDB [test]> SELECT CAST(0xFFFF AS CHAR(10) CHARACTER SET utf8) AS ch, HEX(CAST(0xFFFF AS CHAR(10) CHARACTER SET utf8)) AS hex;
      +----+------+
      | ch | hex  |
      +----+------+
      | ��   | FFFF |
      +----+------+
      1 row in set (0.00 sec)
      

      The expected result would be to replace bad bytes to question
      marks and produce a warning.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: