Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-1154

mcsapi causes data corruption if a NUL termination is sent with a string

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • Icebox
    • None
    • None
    • 2018-01, 2018-02

    Description

      The following example will cause corruption due to the extra NULs at the end of the first string:

      #include <libmcsapi/mcsapi.h>
      #include <iostream>
       
      int main(void)
      {
          mcsapi::ColumnStoreDriver* driver = nullptr;
          mcsapi::ColumnStoreBulkInsert* bulk = nullptr;
          try {
              driver = new mcsapi::ColumnStoreDriver();
              bulk = driver->createBulkInsert("test", "t1", 0, 0);
              bulk->setColumn(0, 1);
      	std::string str("hello world1");
      	str.resize(14);
              bulk->setColumn(1, str);
              bulk->writeRow();
              bulk->setColumn(0, 2);
              bulk->setColumn(1, "hello world4");
              bulk->writeRow();
              bulk->setColumn(0, 3);
              bulk->setColumn(1, "hello world9");
              bulk->writeRow();
              bulk->setColumn(0, 4);
              bulk->setColumn(1, "hello world16");
              bulk->writeRow();
              bulk->commit();
          } catch (mcsapi::ColumnStoreError &e) {
              std::cout << "Error caught: " << e.what() << std::endl;
          }
          delete bulk;
          delete driver;
      }
      

      Attachments

        Issue Links

          Activity

            LinuxJedi Andrew Hutchings (Inactive) created issue -

            Patch trims off trailing NULs from VARCHAR/CHAR/TEXT data.

            For QA: test mcol1154 included in regression suite

            LinuxJedi Andrew Hutchings (Inactive) added a comment - Patch trims off trailing NULs from VARCHAR/CHAR/TEXT data. For QA: test mcol1154 included in regression suite
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Field Original Value New Value
            Assignee Andrew Hutchings [ linuxjedi ] Jens Rowekamp [ jens.rowekamp ]
            Status Open [ 1 ] In Review [ 10002 ]
            jens.rowekamp Jens Röwekamp (Inactive) made changes -
            Status In Review [ 10002 ] Needs Feedback [ 10501 ]

            Can't reproduce the bug on Ubuntu 16.04 and CentOS 7.

            Locally copied test/mcol-1154.cpp and test/CMakeLists.txt from branch MCOL-1154 to branches master and develop-1.1.
            Compiled and installed branch master with flag TEST_RUNNER=ON and ran make check. All 16 tests including mcol-1154 passed.
            Compiled and installed branch develop-1.1 with flag TEST_RUNNER=ON and ran make check. All 16 tests including mcol-1154 passed.
            Compiled and installed branch MCOL-1154 with flag TEST_RUNNER=ON and ran make check. All 16 tests including mcol-1154 passed.

            More information about failing OS or bug needed. Maybe test case needs to be adapted to show the actual bug.

            jens.rowekamp Jens Röwekamp (Inactive) added a comment - - edited Can't reproduce the bug on Ubuntu 16.04 and CentOS 7. Locally copied test/mcol-1154.cpp and test/CMakeLists.txt from branch MCOL-1154 to branches master and develop-1.1. Compiled and installed branch master with flag TEST_RUNNER=ON and ran make check. All 16 tests including mcol-1154 passed. Compiled and installed branch develop-1.1 with flag TEST_RUNNER=ON and ran make check. All 16 tests including mcol-1154 passed. Compiled and installed branch MCOL-1154 with flag TEST_RUNNER=ON and ran make check. All 16 tests including mcol-1154 passed. More information about failing OS or bug needed. Maybe test case needs to be adapted to show the actual bug.
            jens.rowekamp Jens Röwekamp (Inactive) made changes -
            Assignee Jens Rowekamp [ jens.rowekamp ] Andrew Hutchings [ linuxjedi ]
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Status Needs Feedback [ 10501 ] In Review [ 10002 ]
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Assignee Andrew Hutchings [ linuxjedi ] Jens Rowekamp [ jens.rowekamp ]

            Fixed the test, only worked if table was already created and had been queried due to caches.

            LinuxJedi Andrew Hutchings (Inactive) added a comment - Fixed the test, only worked if table was already created and had been queried due to caches.
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Sprint 2018-01 [ 218 ] 2018-01, 2018-02 [ 218, 222 ]
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Status In Review [ 10002 ] Needs Feedback [ 10501 ]
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Assignee Jens Rowekamp [ jens.rowekamp ] Andrew Hutchings [ linuxjedi ]

            And now the fix doesn't work...

            LinuxJedi Andrew Hutchings (Inactive) added a comment - And now the fix doesn't work...

            Root cause is completely wrong, abandoning this one and opening a new bug.

            LinuxJedi Andrew Hutchings (Inactive) added a comment - Root cause is completely wrong, abandoning this one and opening a new bug.
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Status Needs Feedback [ 10501 ] In Review [ 10002 ]

            Will open a new bug with the real problem

            LinuxJedi Andrew Hutchings (Inactive) added a comment - Will open a new bug with the real problem
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            Resolution Not a Bug [ 6 ]
            Status In Review [ 10002 ] Closed [ 6 ]
            LinuxJedi Andrew Hutchings (Inactive) made changes -
            dthompson David Thompson (Inactive) made changes -
            Fix Version/s N/A [ 22302 ]
            Fix Version/s 1.1.3 [ 22801 ]
            leonid.fedorov Leonid Fedorov made changes -
            Component/s mcsapi [ 14100 ]

            People

              LinuxJedi Andrew Hutchings (Inactive)
              LinuxJedi Andrew Hutchings (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.