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

UBSAN: Many overflow issues in strings/decimal.c - runtime error: signed integer overflow: x * y cannot be represented in type 'long long int' (on optimized builds)

    XMLWordPrintable

Details

    Description

      Each of these testcases leads to UBSAN issues in strings/decimal.c, each with individual stack traces:

      SELECT RIGHT('a', -10000000000000000000);
      

      SELECT LPAD (0,-18446744073709551615,0);
      SELECT RPAD (0,-18446744073709551615,0);
      

      SELECT LOCATE (0,0,-18446744073709551615);
      

      SELECT INSERT (0,18446744073709551616,1,0);
      

      SELECT HEX(COLUMN_CREATE (1,99999999999999999999999999999 AS INT));
      

      SELECT COLUMN_GET (COLUMN_CREATE (1,99999999999999999999999999999 AS DECIMAL),1 AS INT);
      

      SELECT 0 + (10101010101010101010101010101010101010101010101010101010101010101<<4);
      

      These issues and others like it significantly affect UBSAN testing. Please fix asap.

      Setup (though ASAN can likely be left off):

      Compiled with GCC >=7.5.0 (I use GCC 9.3.0) and:
          -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON -DWITH_UBSAN=ON -DWITH_RAPID=OFF -DWSREP_LIB_WITH_ASAN=ON
      Set before execution:
          export UBSAN_OPTIONS=print_stacktrace=1
      

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              Roel Roel Van de Paar
              Votes:
              0 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.