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

storage/connect/reldef.cpp compilation fails in debug mode

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL), 10.3(EOL)
    • 10.2.39, 10.3.30
    • Compiling
    • ubuntu-1604 docker

    Description

      In file included from /usr/include/string.h:635:0,
                       from /tmp/es-build/include/m_string.h:35,
                       from /tmp/es-build/include/my_sys.h:22,
                       from /tmp/es-build/sql/sql_bitmap.h:26,
                       from /tmp/es-build/sql/mysqld.h:23,
                       from /tmp/es-build/sql/handler.h:31,
                       from /tmp/es-build/storage/connect/reldef.cpp:27:
      In function 'char* strncat(char*, const char*, size_t)',
          inlined from 'TABDEF* OEMDEF::GetXdef(PGLOBAL)' at /tmp/es-build/storage/connect/reldef.cpp:503:63:
      /usr/include/x86_64-linux-gnu/bits/string3.h:156:71: error: call to char* __builtin___strncat_chk(char*, const char*, long unsigned int, long unsigned int) might overflow destination buffer [-Werror]
         return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
                                                                             ^
      [ 58%] Building CXX object storage/rocksdb/CMakeFiles/rocksdblib.dir/rocksdb/env/env_posix.cc.o
      cd /tmp/es-build/build/storage/rocksdb && /usr/bin/c++   -DHAVE_CONFIG_H -DHAVE_SCHED_GETCPU=1 -DHAVE_TIMER_DELETE -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_LIB_IO_POSIX -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PLATFORM_POSIX -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DSNAPPY -DZLIB -DZSTD -D_FILE_OFFSET_BITS=64 -I/tmp/es-build/build/include -I/tmp/es-build/include -I/tmp/es-build/sql -I/tmp/es-build/build/pcre -I/tmp/es-build/pcre -I/tmp/es-build/zlib -I/tmp/es-build/build/zlib -I/tmp/es-build/build/storage/rocksdb -I/tmp/es-build/storage/rocksdb/rocksdb -I/tmp/es-build/storage/rocksdb/rocksdb/include -isystem /tmp/es-build/storage/rocksdb/rocksdb/third-party/gtest-1.7.0/fused-src -I/tmp/es-build/storage/rocksdb/rocksdb/util  -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fPIC -fno-rtti -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -DSAFEMALLOC -Wall -Wextra -Wformat-security -Wno-init-self -Wno-unused-parameter -Woverloaded-virtual -Wvla -Wwrite-strings -Werror -Wno-error=maybe-uninitialized   -fPIC -fno-builtin-memcmp -frtti -std=gnu++11 -o CMakeFiles/rocksdblib.dir/rocksdb/env/env_posix.cc.o -c /tmp/es-build/storage/rocksdb/rocksdb/env/env_posix.cc
      cc1plus: all warnings being treated as errors
      storage/connect/CMakeFiles/connect.dir/build.make:638: recipe for target 'storage/connect/CMakeFiles/connect.dir/reldef.cpp.o' failed
      make[2]: *** [storage/connect/CMakeFiles/connect.dir/reldef.cpp.o] Error 1
      make[2]: Leaving directory '/tmp/es-build/build'
      CMakeFiles/Makefile2:3472: recipe for target 'storage/connect/CMakeFiles/connect.dir/all' failed
      make[1]: *** [storage/connect/CMakeFiles/connect.dir/all] Error 2
      make[1]: *** Waiting for unfinished jobs....
      

      Attachments

        Activity

          bar Alexander Barkov added a comment - - edited

          Hi bertrandop,
          Can you please fix this?

          In the MariaDB code we avoid using strcat()/strncat(), as they are slow and unsafe.

          Please use strxnmov() or my_snprintf() instead.
          Some examples:

              strxnmov(path, FN_REFLEN-1, mysql_real_data_home, thd->db ? thd->db : "",
                       NullS)
          

            my_snprintf(p, bufflen - (p - buff), "/%s%lx_%llx_%x",
                        tmp_file_prefix, current_pid,
                        thd->thread_id, thd->tmp_table++);
          

          bar Alexander Barkov added a comment - - edited Hi bertrandop , Can you please fix this? In the MariaDB code we avoid using strcat()/strncat(), as they are slow and unsafe. Please use strxnmov() or my_snprintf() instead. Some examples: strxnmov(path, FN_REFLEN-1, mysql_real_data_home, thd->db ? thd->db : "" , NullS) my_snprintf(p, bufflen - (p - buff), "/%s%lx_%llx_%x" , tmp_file_prefix, current_pid, thd->thread_id, thd->tmp_table++);

          Apparently the compilation only failed in this particular example because all warnings were treated as errors. Nowhere else did this occured, for instance on buildbot.

          I 'd be glad to get rid of strcat, strncat, especially strncat that is cumbersome to use. The problem is that the CONNECT code contains about three hundred use of these functions. To fix all these without the risk of making potential errors that would make CONNECT unstable will require more than just doing manually these changes. Any idea?

          bertrandop Olivier Bertrand added a comment - Apparently the compilation only failed in this particular example because all warnings were treated as errors. Nowhere else did this occured, for instance on buildbot. I 'd be glad to get rid of strcat, strncat, especially strncat that is cumbersome to use. The problem is that the CONNECT code contains about three hundred use of these functions. To fix all these without the risk of making potential errors that would make CONNECT unstable will require more than just doing manually these changes. Any idea?

          Nowhere else did this occured, for instance on buildbot.

          yes, it may be disabled with -DMYSQL_MAINTAINER_MODE=OFF, which is current workaround

          abychko Alexey Bychko (Inactive) added a comment - Nowhere else did this occured, for instance on buildbot. yes, it may be disabled with -DMYSQL_MAINTAINER_MODE=OFF , which is current workaround

          What is the status of this one, please?

          julien.fritsch Julien Fritsch added a comment - What is the status of this one, please?

          Will be progressively done in long term. Don't expect miracles.

          bertrandop Olivier Bertrand added a comment - Will be progressively done in long term. Don't expect miracles.

          People

            tturenko Timofey Turenko
            abychko Alexey Bychko (Inactive)
            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.