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

MSAN use-of-uninitialized-value in strstr() in mariadb_get_install_location()

    XMLWordPrintable

    Details

      Description

      MemorySanitizer is issuing errors like this:

      3.1 93618b4036d61a4425154c7d8bc41647872b64cd

      Uninitialized bytes in StrstrCheck at offset 58 inside [0x7fff5b6ab880, 60)
      ==38278==WARNING: MemorySanitizer: use-of-uninitialized-value
          #0 0x562d177ea77e in strstr (/dev/shm/10.5msan/libmariadb/mariadb_config/mariadb_config+0x2e77e)
          #1 0x562d17855fe4 in mariadb_get_install_location /dev/shm/10.5msan/libmariadb/mariadb_config/mariadb_config.c:193:8
          #2 0x562d17855688 in main /dev/shm/10.5msan/libmariadb/mariadb_config/mariadb_config.c:214:3
          #3 0x7f1ad1985cc9 in __libc_start_main csu/../csu/libc-start.c:308:16
          #4 0x562d177dc2a9 in _start (/dev/shm/10.5msan/libmariadb/mariadb_config/mariadb_config+0x202a9)
       
        Uninitialized value was created by an allocation of '' in the stack frame of function 'mariadb_get_install_location'
          #0 0x562d17855c60 in mariadb_get_install_location /dev/shm/10.5msan/libmariadb/mariadb_config/mariadb_config.c:146
       
      SUMMARY: MemorySanitizer: use-of-uninitialized-value (/dev/shm/10.5msan/libmariadb/mariadb_config/mariadb_config+0x2e77e) in strstr
      Exiting
      

      As far as I can tell, the problem was recently introduced. We fail to ensure that the string is terminated by a NUL byte. Most of the time, it might happen to hold after executing alloca().

        Attachments

          Activity

            People

            Assignee:
            marko Marko Mäkelä
            Reporter:
            marko Marko Mäkelä
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: