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

Memory and heap corruption using revision 79 in Windows application.

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Windows using Maria C-API revision 79+81

    Description

      We have seen this 3 times (2 of the 3 cases may be identical). Both were seen in a 32 bit environment. In one of the 3 cases it happens only with 'compressed protocol' enabled, and when building same applciation as 64 bit it does not happen. In the other two it happens without using 'compressed protocol'.

      Private details will be mailed directly to Georg and Wlad. This JIRA report is created as I before have been asked to create such whenever reporting an issue (I think dev's need it for bookkeeping, time registration etc. purposes)

      Attachments

        Activity

          georg Georg Richter added a comment -

          The crash happens if the amount of compressed packages is equal to net buffer size, since the additional terminating zero can't be set.

          georg Georg Richter added a comment - The crash happens if the amount of compressed packages is equal to net buffer size, since the additional terminating zero can't be set.
          georg Georg Richter added a comment -

          Fixed in rev. 82

          georg Georg Richter added a comment - Fixed in rev. 82

          After checking out the latest source (revision 82) and generating Visual Studio solution file with
          cmake . -G"Visual Studio 10" &
          cmake . -G"Visual Studio 10 Win64"
          generates the solution file.

          While trying to compile the latest revision of the library, this fails with the following error:
          Error 10 error C1083: Cannot open include file: 'iconv.h': No such file or directory D:\mariadb_revisions\mariadbclient\libmariadb\my_charset.c 55 1 mariadbclient

          Now, adding the path to "iconv.h" (within the client library directory, "win-iconv")
          gets rid of the error but ends up with several of these warnings.

          (64 - Bit)
          1>ma_dyncol.c(1661): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data
          1>ma_dyncol.c(3860): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data
          1>ma_dyncol.c(3899): warning C4013: 'convert_string' undefined; assuming extern returning int
          1>ma_dyncol.c(3956): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data
          1>ma_dyncol.c(4210): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data
          1>ma_dyncol.c(4405): warning C4098: 'mariadb_dyncol_free' : 'void' function returning a value

          1>my_charset.c(1085): warning C4013: 'my_snprintf' undefined; assuming extern returning int
          1> violite.c
          1>violite.c(211): warning C4267: 'function' : conversion from 'size_t' to 'DWORD', possible loss of data
          1>violite.c(216): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
          1>violite.c(238): warning C4133: 'function' : incompatible types - from 'size_t *' to 'u_long *'
          1>violite.c(274): warning C4267: 'function' : conversion from 'size_t' to 'DWORD', possible loss of data
          1>violite.c(279): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
          1>violite.c(469): warning C4013: 'my_inet_ntoa' undefined; assuming extern returning int
          1> net.c
          1>net.c(173): warning C4267: '=' : conversion from 'size_t' to 'unsigned long', possible loss of data
          1>net.c(647): warning C4267: '=' : conversion from 'size_t' to 'ulong', possible loss of data
          1>net.c(695): warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data
          1>net.c(704): warning C4267: 'return' : conversion from 'size_t' to 'ulong', possible loss of data
          1>net.c(754): warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data
          1>net.c(755): warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data
          1>net.c(764): warning C4267: 'return' : conversion from 'size_t' to 'ulong', possible loss of data

          1>dbug.c(1116): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1116): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1117): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1118): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1118): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1121): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1121): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1128): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1129): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1129): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1132): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>dbug.c(1292): warning C4013: 'my_snprintf' undefined; assuming extern returning int

          1>libmariadb.c(222): warning C4244: 'function' : conversion from 'SOCKET' to 'int', possible loss of data
          1>libmariadb.c(1602): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data
          1>libmariadb.c(1787): warning C4244: '=' : conversion from '__int64' to 'uint', possible loss of data
          1>libmariadb.c(1790): warning C4244: '=' : conversion from '__int64' to 'uint', possible loss of data
          1>libmariadb.c(1850): warning C4267: 'function' : conversion from 'size_t' to 'unsigned int', possible loss of data
          1>libmariadb.c(3136): warning C4244: 'return' : conversion from '__int64' to 'ulong', possible loss of data

          1>my_compress.c(66): warning C4267: '=' : conversion from 'size_t' to 'ulong', possible loss of data
          1>my_compress.c(78): warning C4133: 'function' : incompatible types - from 'size_t *' to 'uLongf *'
          1>my_compress.c(78): warning C4267: 'function' : conversion from 'size_t' to 'uLong', possible loss of data

          1>my_stmt.c(268): warning C4013: 'simple_command' undefined; assuming extern returning int
          1>my_stmt.c(1355): warning C4018: '<' : signed/unsigned mismatch
          1> my_loaddata.c
          1>my_loaddata.c(100): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
          1>my_loaddata.c(109): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data

          1>my_auth.c(237): warning C4013: 'simple_command' undefined; assuming extern returning int
          1>my_auth.c(497): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
          1>my_auth.c(499): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
          1>my_auth.c(529): warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data
          1>my_auth.c(533): warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data
          1>my_auth.c(543): warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data
          1>my_auth.c(681): warning C4267: '=' : conversion from 'size_t' to 'uint', possible loss of data

          And while compiling 32-bit library results in these warnings:
          1>ma_dyncol.c(578): warning C4244: '=' : conversion from 'ulonglong' to 'size_t', possible loss of data
          1>ma_dyncol.c(2819): warning C4244: '+=' : conversion from '__int64' to 'size_t', possible loss of data
          1>ma_dyncol.c(2985): warning C4244: '+=' : conversion from '__int64' to 'size_t', possible loss of data
          1>ma_dyncol.c(3039): warning C4244: 'function' : conversion from '__int64' to 'size_t', possible loss of data
          1>ma_dyncol.c(3041): warning C4244: '+=' : conversion from '__int64' to 'size_t', possible loss of data
          1>ma_dyncol.c(3530): warning C4244: '=' : conversion from '__int64' to 'size_t', possible loss of data
          1>ma_dyncol.c(3531): warning C4244: '=' : conversion from '__int64' to 'size_t', possible loss of data
          1>ma_dyncol.c(3899): warning C4013: 'convert_string' undefined; assuming extern returning int
          1>ma_dyncol.c(4405): warning C4098: 'mariadb_dyncol_free' : 'void' function returning a value
          1>my_charset.c(1084): warning C4013: 'my_snprintf' undefined; assuming extern returning int
          1> violite.c
          1>violite.c(469): warning C4013: 'my_inet_ntoa' undefined; assuming extern returning int
          1>dbug.c(1292): warning C4013: 'my_snprintf' undefined; assuming extern returning int
          rror.c
          1>my_stmt.c(268): warning C4013: 'simple_command' undefined; assuming extern returning int
          1>my_stmt.c(1355): warning C4018: '<' : signed/unsigned mismatch
          1>my_auth.c(237): warning C4013: 'simple_command' undefined; assuming extern returning int

          Can these warnings be fixed?

          However, ignoring the warnings and building a sample application fails to link with the client library with the following errors:
          1>mariadbclient.lib(my_charset.obj) : error LNK2019: unresolved external symbol _iconv_close referenced in function _convert_string
          1>mariadbclient.lib(my_charset.obj) : error LNK2019: unresolved external symbol _iconv referenced in function _convert_string
          1>mariadbclient.lib(my_charset.obj) : error LNK2019: unresolved external symbol _iconv_open referenced in function _convert_string
          1>D:\sample\mariadb_test\Debug\mariadb_test.exe : fatal error LNK1120: 3 unresolved externals

          Are we missing something?
          Linking issues never happened before (until revision 80)

          sandhyasriraj Sandhya Sriraj added a comment - After checking out the latest source (revision 82) and generating Visual Studio solution file with cmake . -G"Visual Studio 10" & cmake . -G"Visual Studio 10 Win64" generates the solution file. While trying to compile the latest revision of the library, this fails with the following error: Error 10 error C1083: Cannot open include file: 'iconv.h': No such file or directory D:\mariadb_revisions\mariadbclient\libmariadb\my_charset.c 55 1 mariadbclient Now, adding the path to "iconv.h" (within the client library directory, "win-iconv") gets rid of the error but ends up with several of these warnings. (64 - Bit) 1>ma_dyncol.c(1661): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data 1>ma_dyncol.c(3860): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data 1>ma_dyncol.c(3899): warning C4013: 'convert_string' undefined; assuming extern returning int 1>ma_dyncol.c(3956): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data 1>ma_dyncol.c(4210): warning C4267: 'function' : conversion from 'size_t' to 'ulong', possible loss of data 1>ma_dyncol.c(4405): warning C4098: 'mariadb_dyncol_free' : 'void' function returning a value 1>my_charset.c(1085): warning C4013: 'my_snprintf' undefined; assuming extern returning int 1> violite.c 1>violite.c(211): warning C4267: 'function' : conversion from 'size_t' to 'DWORD', possible loss of data 1>violite.c(216): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data 1>violite.c(238): warning C4133: 'function' : incompatible types - from 'size_t *' to 'u_long *' 1>violite.c(274): warning C4267: 'function' : conversion from 'size_t' to 'DWORD', possible loss of data 1>violite.c(279): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data 1>violite.c(469): warning C4013: 'my_inet_ntoa' undefined; assuming extern returning int 1> net.c 1>net.c(173): warning C4267: '=' : conversion from 'size_t' to 'unsigned long', possible loss of data 1>net.c(647): warning C4267: '=' : conversion from 'size_t' to 'ulong', possible loss of data 1>net.c(695): warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data 1>net.c(704): warning C4267: 'return' : conversion from 'size_t' to 'ulong', possible loss of data 1>net.c(754): warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data 1>net.c(755): warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data 1>net.c(764): warning C4267: 'return' : conversion from 'size_t' to 'ulong', possible loss of data 1>dbug.c(1116): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1116): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1117): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1118): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1118): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1121): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1121): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1128): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1129): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1129): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1132): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>dbug.c(1292): warning C4013: 'my_snprintf' undefined; assuming extern returning int 1>libmariadb.c(222): warning C4244: 'function' : conversion from 'SOCKET' to 'int', possible loss of data 1>libmariadb.c(1602): warning C4267: 'function' : conversion from 'size_t' to 'uint', possible loss of data 1>libmariadb.c(1787): warning C4244: '=' : conversion from '__int64' to 'uint', possible loss of data 1>libmariadb.c(1790): warning C4244: '=' : conversion from '__int64' to 'uint', possible loss of data 1>libmariadb.c(1850): warning C4267: 'function' : conversion from 'size_t' to 'unsigned int', possible loss of data 1>libmariadb.c(3136): warning C4244: 'return' : conversion from '__int64' to 'ulong', possible loss of data 1>my_compress.c(66): warning C4267: '=' : conversion from 'size_t' to 'ulong', possible loss of data 1>my_compress.c(78): warning C4133: 'function' : incompatible types - from 'size_t *' to 'uLongf *' 1>my_compress.c(78): warning C4267: 'function' : conversion from 'size_t' to 'uLong', possible loss of data 1>my_stmt.c(268): warning C4013: 'simple_command' undefined; assuming extern returning int 1>my_stmt.c(1355): warning C4018: '<' : signed/unsigned mismatch 1> my_loaddata.c 1>my_loaddata.c(100): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data 1>my_loaddata.c(109): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data 1>my_auth.c(237): warning C4013: 'simple_command' undefined; assuming extern returning int 1>my_auth.c(497): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data 1>my_auth.c(499): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data 1>my_auth.c(529): warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data 1>my_auth.c(533): warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data 1>my_auth.c(543): warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data 1>my_auth.c(681): warning C4267: '=' : conversion from 'size_t' to 'uint', possible loss of data And while compiling 32-bit library results in these warnings: 1>ma_dyncol.c(578): warning C4244: '=' : conversion from 'ulonglong' to 'size_t', possible loss of data 1>ma_dyncol.c(2819): warning C4244: '+=' : conversion from '__int64' to 'size_t', possible loss of data 1>ma_dyncol.c(2985): warning C4244: '+=' : conversion from '__int64' to 'size_t', possible loss of data 1>ma_dyncol.c(3039): warning C4244: 'function' : conversion from '__int64' to 'size_t', possible loss of data 1>ma_dyncol.c(3041): warning C4244: '+=' : conversion from '__int64' to 'size_t', possible loss of data 1>ma_dyncol.c(3530): warning C4244: '=' : conversion from '__int64' to 'size_t', possible loss of data 1>ma_dyncol.c(3531): warning C4244: '=' : conversion from '__int64' to 'size_t', possible loss of data 1>ma_dyncol.c(3899): warning C4013: 'convert_string' undefined; assuming extern returning int 1>ma_dyncol.c(4405): warning C4098: 'mariadb_dyncol_free' : 'void' function returning a value 1>my_charset.c(1084): warning C4013: 'my_snprintf' undefined; assuming extern returning int 1> violite.c 1>violite.c(469): warning C4013: 'my_inet_ntoa' undefined; assuming extern returning int 1>dbug.c(1292): warning C4013: 'my_snprintf' undefined; assuming extern returning int rror.c 1>my_stmt.c(268): warning C4013: 'simple_command' undefined; assuming extern returning int 1>my_stmt.c(1355): warning C4018: '<' : signed/unsigned mismatch 1>my_auth.c(237): warning C4013: 'simple_command' undefined; assuming extern returning int Can these warnings be fixed? However, ignoring the warnings and building a sample application fails to link with the client library with the following errors: 1>mariadbclient.lib(my_charset.obj) : error LNK2019: unresolved external symbol _iconv_close referenced in function _convert_string 1>mariadbclient.lib(my_charset.obj) : error LNK2019: unresolved external symbol _iconv referenced in function _convert_string 1>mariadbclient.lib(my_charset.obj) : error LNK2019: unresolved external symbol _iconv_open referenced in function _convert_string 1>D:\sample\mariadb_test\Debug\mariadb_test.exe : fatal error LNK1120: 3 unresolved externals Are we missing something? Linking issues never happened before (until revision 80)

          People

            georg Georg Richter
            Peter Laursen Peter Laursen
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.