Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-14

Crash in my_malloc during prepared statement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Kubuntu 12.10 x64

    Description

      I am getting a crash when trying to use prepared statements. I'm connecting to MySQL 5.5 via sockets. I'm using version 1.0.0 of the C library. The application does not crash when using the MySQL 5.1 or 5.5 client libraries.

      Back trace:

      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x7fffeeeff700 (LWP 28598)]
      _db_enter_ (_func_=_func_@entry=0x7ffff01f5360 "my_malloc", _file_=_file_@entry=0x7ffff01f5330 "/tmp/mariadb-native-client/libmysql/my_malloc.c", _line_=_line_@entry=31, _sfunc_=_sfunc_@entry=0x7fffeeefe708,
          _sfile_=_sfile_@entry=0x7fffeeefe710, _slevel_=_slevel_@entry=0x7fffeeefe704, _sframep_=_sframep_@entry=0x7fffeeefe718) at /tmp/mariadb-native-client/libmysql/dbug.c:712
      712     /tmp/mariadb-native-client/libmysql/dbug.c: No such file or directory.
      (gdb) bt
      #0  _db_enter_ (_func_=_func_@entry=0x7ffff01f5360 "my_malloc", _file_=_file_@entry=0x7ffff01f5330 "/tmp/mariadb-native-client/libmysql/my_malloc.c", _line_=_line_@entry=31, _sfunc_=_sfunc_@entry=0x7fffeeefe708,
          _sfile_=_sfile_@entry=0x7fffeeefe710, _slevel_=_slevel_@entry=0x7fffeeefe704, _sframep_=_sframep_@entry=0x7fffeeefe718) at /tmp/mariadb-native-client/libmysql/dbug.c:712
      #1  0x00007ffff01e4543 in my_malloc (Size=Size@entry=864, MyFlags=MyFlags@entry=48) at /tmp/mariadb-native-client/libmysql/my_malloc.c:31
      #2  0x00007ffff01ec1d8 in mysql_stmt_init (mysql=0x555555941618) at /tmp/mariadb-native-client/libmysql/my_stmt.c:1029
      #3  0x00007ffff040a11d in MySQL_Execute (sql_conn_num=0, stmt=0x7fffeeefe9d0, request=0x0, query_type=1, error=0x7fffeeefe890 "[", errlen=255) at monetra_mysql.c:599
      #4  0x0000555555633750 in M_SQL_Execute (prepared_stmt_ptr=0x7fffeeefe9d0, stmt=0x0, tran_type=1, error=0x0, errlen=0) at sql.c:805
      #5  0x000055555561f540 in M_Recurring_init () at recurring/recurring_manage.c:1190
      #6  0x00005555555a443e in cron_loop (arg=0x0) at cron.c:1515
      #7  0x000055555566fc13 in M_thread_func (arg=0x555555a41d68) at thread/thread.c:531
      #8  0x00007ffff7377e9a in start_thread (arg=0x7fffeeeff700) at pthread_create.c:308
      #9  0x00007ffff6c85cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
      #10 0x0000000000000000 in ?? ()

      When trying to build the client with debug symbols I'm running into another issue:

      [ 42%] Building C object libmysql/CMakeFiles/libmariadb.dir/my_stmt.c.o
      cd /tmp/mariadb-native-client/libmysql && /usr/bin/gcc  -Dlibmariadb_EXPORTS -DHAVE_OPENSSL -g -DSAFEMALLOC -DSAFE_MUTEX -fPIC -I/tmp/mariadb-native-client/include -I/tmp/mariadb-native-client/libmysql -I/usr/local/ssl/include    -D ENABLED_LOCAL_INFILE -D HAVE_COMPRESS -D THREAD -o CMakeFiles/libmariadb.dir/my_stmt.c.o   -c /tmp/mariadb-native-client/libmysql/my_stmt.c
      /tmp/mariadb-native-client/libmysql/my_stmt.c: In function ‘mysql_stmt_execute_generate_request’:
      /tmp/mariadb-native-client/libmysql/my_stmt.c:640:3: error: ‘ALLOW_ZERO_PTR’ undeclared (first use in this function)
      /tmp/mariadb-native-client/libmysql/my_stmt.c:640:3: note: each undeclared identifier is reported only once for each function it appears in
      make[2]: *** [libmysql/CMakeFiles/libmariadb.dir/my_stmt.c.o] Error 1
      make[2]: Leaving directory `/tmp/mariadb-native-client'
      make[1]: *** [libmysql/CMakeFiles/libmariadb.dir/all] Error 2
      make[1]: Leaving directory `/tmp/mariadb-native-client'
      make: *** [all] Error 2

      Here is my build line:

      cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DOPENSSL_INCLUDE_DIR=/usr/local/ssl/include -DOPENSSL_CRYPTO_LIBRARY=/usr/local/ssl/lib/libcrypto.so -DOPENSSL_SSL_LIBRARY=/usr/local/ssl/lib/libssl.so -DCMAKE_BUILD_TYPE=Debug . && make VERBOSE=1

      Since the debug build is failing when trying to compile my_stmt.c I think these two issues are related.

      Attachments

        Activity

          People

            georg Georg Richter
            user_none John Schember
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.