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

    XMLWordPrintable

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

            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.