Bug #114006 MySqlHelper.ExecuteReaderAsync causes stack overflow
Submitted: 15 Feb 2024 13:51 Modified: 15 Jul 19:51
Reporter: Cuno Lorenz Klopfenstein Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:8.3.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Stack Overflow

[15 Feb 2024 13:51] Cuno Lorenz Klopfenstein
Description:
One of the overloads of the MySqlHelper.ExecuteReaderAsync methods appears to be implemented as follows:

public static Task<MySqlDataReader> ExecuteReaderAsync(string connectionString, string commandText, params MySqlParameter[] commandParameters) {
    return ExecuteReaderAsync(connectionString, commandText, commandParameters);
}

Instead of forwarding the method call to the actual execution, the method calls itself in an infinite loop, causing a stack overflow. The other method overloads appears to be unaffected.

How to repeat:
Create a clean .NET 8 Console application, with Mysql.Data 8.3.0.

Code:

using MySql.Data.MySqlClient;

var reader = await MySqlHelper.ExecuteReaderAsync(
    "SERVER=localhost;PORT=3306;DATABASE=DB;UID=root;PASSWORD=PWD",
    "SELECT * FROM Table WHERE id = @id",
    new MySqlParameter("@id", 42)
);

reader.Read();
[15 Feb 2024 15:01] MySQL Verification Team
Hello Klopfenstein,

Thank you for the report and feedback.

regards,
Umesh
[16 Feb 2024 4:45] Bradley Grainger
Duplicate of bug #111916.
[8 Jun 20:57] Omar Chavez
Posted by developer:
 
there was a method that called himself until it caused an exception. fixed this bug by calling the correct method instead.
[15 Jul 19:51] Daniel So
Posted by developer:
 
Added the following entry to the Connector/NET 9.4.0 changelog: 

"Calling the MySqlHelper.ExecuteReaderAsync(string connectionString, string commandText, params MySqlParameter[] commandParameters) overload caused a stack overflow."