Bug #121305 mysql_query_attribute_string() accepts an INTEGER argument
Submitted: 17 Sep 8:59 Modified: 17 Sep 10:47
Reporter: chi zhang Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:9.7.2, 26.7.0 OS:Any
Assigned to: CPU Architecture:Any

[17 Sep 8:59] chi zhang
Description:
mysql_query_attribute_string() successfully initializes and executes when its argument is an INTEGER, although the function requires a string argument. The invalid input is accepted instead of producing the implemented string-argument diagnostic.

Actual result:
The statement completes successfully and returns:
invalid_integer_was_accepted
0

Expected result:
The SELECT must fail during UDF initialization with the implemented diagnostic that mysql_query_attribute_string() expects a string argument. Returning a row is incorrect because the INTEGER argument does not satisfy the function's declared input contract.

Impact:
Callers can supply an unsupported argument type without receiving the required initialization error. The function then executes outside its declared input contract and can return a misleading result. No crash, data loss, or security consequence was observed.

Tested versions:
MySQL Community Server 9.7.2 and 26.7.0.

Environment and configuration:
MySQL Community Server - GPL for Linux on x86_64, source commit e174239c5b3c2bcf164649042ab8a7fc972ce88d. No relevant non-default configuration was recorded. The issue reproduced on both tested versions.

How to repeat:
INSTALL COMPONENT 'file://component_query_attributes';

SELECT mysql_query_attribute_string(123) IS NULL
  AS invalid_integer_was_accepted;
[17 Sep 10:47] Shane Bester
please see https://bugs.mysql.com/bug.php?id=121294