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

QUOTE() does not work well with unassigned characters

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.3.12, 5.5.39, 10.0.13
    • 10.4, 10.5, 10.6
    • None
    • 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().

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.