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

QUOTE() does not work well with unassigned characters

    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

      MariaDB [test]> SELECT HEX(_big5 0xC840), HEX(QUOTE(_big5 0xC840));
      +-------------------+--------------------------+
      | HEX(_big5 0xC840) | HEX(QUOTE(_big5 0xC840)) |
      +-------------------+--------------------------+
      | C840              | NULL                     |
      +-------------------+--------------------------+
      1 row in set (0.00 sec)
      

      The result for in the second column is wrong.
      The expected result is C840, similar to the first column.

      The problem happens because Item_func_quote::val_str()
      uses an mb_wc()..wc_mb() loop, which breaks and returns
      null on unassigned characters.

      The loop should be fixed to use a native non-Unicode API instead, e.g. ismbchar().

        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: