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

using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data

    XMLWordPrintable

Details

    Description

      Customer trying to do the following:

      INSERT INTO `t1` VALUES (1,'',NULL,38391,'2017-06-24 07:35:28');
      update t1 set directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW();
      

      Table definition:

      Create Table: CREATE TABLE `t1` (
        `id` int(11) NOT NULL,
        `session_id` varchar(255) DEFAULT NULL,
        `directory` mediumtext,
        `checksum` int(10) DEFAULT NULL,
        `last_update` datetime DEFAULT NULL,
        PRIMARY KEY (`id`),
        KEY `lastupdate` (`last_update`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      

      The above update saves corrupted data.

      • On 10.0 it saves NULL
      • On 10.1 and 10.2 it saves an encrypted version of the empty string
      • This only happens when UPDATING; running SELECT AES_ENCRYPT.(CONVERT(...)) works fine!
      • It appears to work fine up to some length of the string to be converted (issue does not happen if the string fed to CONVERT() is less than 700 chars or so)

      Attachments

        Activity

          People

            bar Alexander Barkov
            rpizzi Rick Pizzi (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            7 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.