Bug #110677 Prepared statement assertion error
Submitted: 13 Apr 2023 9:37 Modified: 12 Sep 2023 16:56
Reporter: Pedro Ferreira Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Prepared statements Severity:S6 (Debug Builds)
Version:8.0.32 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: execute, prepare statement

[13 Apr 2023 9:37] Pedro Ferreira
Description:
Run these queries:

PREPARE p0 FROM 'SELECT format_bytes(?)';
SET @a0 = NULL;
EXECUTE p0 USING @a0;

The EXECUTE statement will trigger an assertion error at sql/item.cc:4121
assert(data_type() != MYSQL_TYPE_INVALID);

The compilation parameters are the same as issue 108148:

-DWITH_DEBUG=1 -DWITH_ASAN=ON -DWITH_UBSAN=ON and boost library version 1.77

How to repeat:
Run the queries above.
[13 Apr 2023 10:13] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback.
Observed that 8.0.32 debug build is affected.

regards,
Umesh
[28 Jun 2023 11:25] Pedro Ferreira
Reproduced this assertion error again today with:

PREPARE p0 FROM 'WITH x(x) AS ((SELECT ?) UNION (SELECT ''a'')) SELECT 1 FROM x WHERE x.x';
SET @a0 = 'a';EXECUTE p0 USING @a0;
[12 Sep 2023 16:56] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL 8.3.0 release, and here's the proposed changelog entry from the documentation team:

Several functions did not have a default data-type assignment for their
arguments, which could affect prepared statements by raising an assertion
error in debug builds. These default types now are assigned: 

DOUBLE for format_bytes() and format_pico_time() 
BIGINT for ps_thread_id()

Thank you for the bug report.
[17 Jan 2024 18:30] Jean-François Gagné
This is flagged as fixed in 8.3.0, but also as affecting 8.0.32.

Will this be fixed in a future 8.0 release.