Bug #112149 Inconsistent results caused by SPACE() function and ''||'' operations

Submitted: 23 Aug 2023 4:09 Modified: 23 Aug 2023 8:14
Reporter: Zuming Jiang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S2 (Serious)
Version:8.0.34, 5.7.43, 5.6, 5.5 OS:Any
Assigned to: CPU Architecture:Any

[23 Aug 2023 4:09] Zuming Jiang
Description:
Dear MySQL developers,

I used my new fuzzer to fuzz MySQL and found a logic bug that make MySQL server output inconsistent results:

How to repeat:
*** Test Case 1 ***

select nullif(SPACE(5), case when false then ('P') else ('i' || '~') end) as c_4;

I simplified "case when false then ('P') else ('i' || '~') end" to "('i' || '~')", and get Test Case 2:

*** Test Case 2 ***

select nullif(SPACE(5), ('i' || '~')) as c_4;

*** Expected results ***

Test Case 1 and Test Case 2 return the same results.

*** Actual results ***

Test Case 1 and Test Case 2 return inconsistent results.

Test Case 1 return:

+-------+
| c_4   |
+-------+
|       |
+-------+

Test Case 2 return:

+------+
| c_4  |
+------+
| NULL |
+------+
[23 Aug 2023 8:14] MySQL Verification Team
Hello Zuming Jiang,

Thank you for the report and test case.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.