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

Numeric errors, server crash with COLUMN_JSON() on DECIMAL with precision > 40

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0, 10.1
    • 5.5.48, 10.0.23, 10.1.10
    • Dynamic Columns
    • None
    • Darwin yossy.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
    • 10.0.23

    Description

      Lines 4 through 11 of the following input have numeric errors in the JSON output. Line 12 crashes the server.

      $ mysql -fN <<SQL
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.12345678901234567890123456789012345));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.123456789012345678901234567890123456));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.1234567890123456789012345678901234567));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.12345678901234567890123456789012345678));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.123456789012345678901234567890123456789));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.1234567890123456789012345678901234567890));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.12345678901234567890123456789012345678901));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.123456789012345678901234567890123456789012));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.1234567890123456789012345678901234567890123));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.12345678901234567890123456789012345678901234));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.123456789012345678901234567890123456789012345));
      SELECT COLUMN_JSON(COLUMN_CREATE('x', 0.1234567890123456789012345678901234567890123467));
      SQL
      {"x":0.12345678901234567890123456789012345}
      {"x":0.123456789012345678901234567890123456}
      {"x":0.1234567890123456789012345678901234567}
      {"x":0.12345678901234567890123456789012345670}
      {"x":0.123456789012345678901234567890123456700}
      {"x":0.1234567890123456789012345678901234567000}
      {"x":0.12345678901234567890123456789012345670000}
      {"x":0.123456789012345678901234567890123456700000}
      {"x":0.1234567890123456789012345678901234567000000}
      {"x":0.12345678901234567890123456789012345670000000}
      {"x":0.123456789012345678901234567890123456700000000}
      ERROR 2013 (HY000) at line 12: Lost connection to MySQL server during query
      /usr/local/bin/mysqld_safe: line 183:  2570 Abort trap: 6
      150701 09:15:49 mysqld_safe mysqld restarted

      Lines 6 through 13 of the following input have numeric errors in the JSON output. Line 14 crashes the server.

      fsb@yossy [~] ��
      $ mysql -fN <<SQL
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 12345678901234567890123456789012345));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 123456789012345678901234567890123456));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 1234567890123456789012345678901234567));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 12345678901234567890123456789012345678));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 123456789012345678901234567890123456789));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 1234567890123456789012345678901234567890));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 12345678901234567890123456789012345678901));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 123456789012345678901234567890123456789012));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 1234567890123456789012345678901234567890123));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 12345678901234567890123456789012345678901234));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 123456789012345678901234567890123456789012345));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 1234567890123456789012345678901234567890123467));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 12345678901234567890123456789012345678901234678));
      > SELECT COLUMN_JSON(COLUMN_CREATE('x', 123456789012345678901234567890123456789012346789));
      > SQL
      {"x":12345678901234567890123456789012345}
      {"x":123456789012345678901234567890123456}
      {"x":1234567890123456789012345678901234567}
      {"x":12345678901234567890123456789012345678}
      {"x":123456789012345678901234567890123456789}
      {"x":0234567890123456789012345678901234567890}
      {"x":00345678901234567890123456789012345678901}
      {"x":000456789012345678901234567890123456789012}
      {"x":0000567890123456789012345678901234567890123}
      {"x":00000678901234567890123456789012345678901234}
      {"x":000000789012345678901234567890123456789012345}
      {"x":0000000001234567890123456789012345678901234567}
      {"x":00000000012345678901234567890123456789012345678}
      ERROR 2013 (HY000) at line 14: Lost connection to MySQL server during query
      /usr/local/bin/mysqld_safe: line 183:  2584 Abort trap: 6
      150701 09:16:00 mysqld_safe mysqld restarted

      Note 1: JSON supports decimal number with arbitrary precision and scale.

      Note 2: Apart from being numerically wrong, lines 6 through 13 of the output in the second test
      are invalid JSON, which allows only numbers with magnitude less than one to begin with the digit 0.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            thefsb Tom
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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