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

LOAD DATA LOCAL INFILE crashes the server on loading a backslash followed by a multi-byte character

    XMLWordPrintable

Details

    Description

      This script crashes the server when loading the attached file data.txt.

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (
        a int NOT NULL,
        b int NOT NULL,
        c int NOT NULL,
        d int NOT NULL,
        e int NOT NULL,
        f int NOT NULL,
        g int NOT NULL,
        h int NOT NULL,
        i int NOT NULL,
        j int NOT NULL,
        k int NOT NULL,
        l double NOT NULL,
        q varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
      );
      LOAD DATA LOCAL INFILE '/tmp/data.txt'
      INTO TABLE t1 CHARACTER SET utf8
      FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\'
      LINES TERMINATED BY '\n';
      

      Stack trace:

      #0  0x00007ffff5dc4a98 in __GI_raise (sig=sig@entry=6)
          at ../sysdeps/unix/sysv/linux/raise.c:55
      #1  0x00007ffff5dc669a in __GI_abort () at abort.c:89
      #2  0x00007ffff5dbd227 in __assert_fail_base (fmt=<optimized out>, 
          assertion=assertion@entry=0xe81576 "0", 
          file=file@entry=0xe81280 "/home/bar/maria-git/server-10.0.load-local/sql/net_serv.cc", line=line@entry=1074, 
          function=function@entry=0xe815c0 <my_real_read(st_net*, unsigned long*, char)::__PRETTY_FUNCTION__> "ulong my_real_read(NET*, size_t*, my_bool)")
          at assert.c:92
      #3  0x00007ffff5dbd2d2 in __GI___assert_fail (assertion=0xe81576 "0", 
          file=0xe81280 "/home/bar/maria-git/server-10.0.load-local/sql/net_serv.cc", line=1074, 
          function=0xe815c0 <my_real_read(st_net*, unsigned long*, char)::__PRETTY_FUNCTION__> "ulong my_real_read(NET*, size_t*, my_bool)") at assert.c:101
      #4  0x00000000005999a1 in my_real_read (net=0x7ffff40cf328, 
          complen=0x7ffff7f7c3b0, header=0 '\000')
          at /home/bar/maria-git/server-10.0.load-local/sql/net_serv.cc:1074
      #5  0x0000000000599a05 in my_net_read_packet (net=0x7ffff40cf328, 
          read_from_server=0 '\000')
          at /home/bar/maria-git/server-10.0.load-local/sql/net_serv.cc:1137
      #6  0x00000000009cc257 in _my_b_net_read (info=0x7ffff7f7c618, 
          Buffer=0x7ffff7f7c48f "", Count=1)
          at /home/bar/maria-git/server-10.0.load-local/sql/mf_iocache.cc:61
      #7  0x0000000000e0731f in _my_b_get (info=0x7ffff7f7c618)
          at /home/bar/maria-git/server-10.0.load-local/mysys/mf_iocache.c:1509
      #8  0x000000000099ca59 in READ_INFO::skip_data_till_eof (this=0x7ffff7f7c5a0)
          at /home/bar/maria-git/server-10.0.load-local/sql/sql_load.cc:128
      #9  0x00000000009970f5 in mysql_load (thd=0x7ffff40cf070, ex=0x7ffed1822240, 
          table_list=0x7ffed18222c8, fields_vars=..., set_fields=..., 
          set_values=..., handle_duplicates=DUP_ERROR, ignore=true, 
          read_file_from_client=true)
          at /home/bar/maria-git/server-10.0.load-local/sql/sql_load.cc:562 at
      

      Attachments

        1. data.txt
          16 kB
          Alexander Barkov

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              2 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.