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

Wrong result for bitwise AND predicate involving AES_ENCRYPT() and INTERVAL arithmetic

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 11.4.11
    • N/A
    • Optimizer
    • None
    • MariaDB version: 11.4.11-MariaDB-ubu2404
      Docker image: mariadb:11.4
      Host OS: Windows 11
      Runtime environment: Docker Desktop with WSL2 backend
    • Not for Release Notes

    Description

      When a query uses a bitwise AND predicate involving AES_ENCRYPT() and INTERVAL arithmetic, the predicate may be evaluated inconsistently between WHERE filtering and SELECT expression evaluation.

      In this case, the WHERE clause returns an empty result set, while evaluating the same predicate as a SELECT expression indicates that one row satisfies the condition.

      CREATE TABLE t1472 (c1 NUMERIC);
      INSERT INTO t1472 (c1) VALUES (295082);
      SELECT ta2.ca1 FROM (SELECT t1472.c1 FROM t1472) AS ta1 JOIN (SELECT t1472.c1 AS ca1 FROM t1472) AS ta2 WHERE (AES_ENCRYPT((CONCAT(ta2.ca1, ta2.ca1, ta2.ca1, 'kQGVptlWbA2Wa0LQm3eRzeQFby6he8', '2005-09-17 23:39:23')), '16:11:46') & ('241110' - INTERVAL '08:20:28' HOUR_SECOND));
      --empty set
      SELECT SUM(count) FROM (SELECT (AES_ENCRYPT((CONCAT(ta2.ca1, ta2.ca1, ta2.ca1, 'kQGVptlWbA2Wa0LQm3eRzeQFby6he8', '2005-09-17 23:39:23')), '16:11:46') & ('241110' - INTERVAL '08:20:28' HOUR_SECOND)) IS TRUE AS count FROM (SELECT t1472.c1 FROM t1472) AS ta1 JOIN (SELECT t1472.c1 AS ca1 FROM t1472) AS ta2) AS ta_norec;
      --1
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ss Songsong Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.