Bug #57177 Regression of bug #53865: Query > 300B throws System.ArgumentOutOfRangeException

Submitted: 1 Oct 2010 16:35 Modified: 22 Oct 2010 19:28
Reporter: Yvan Rodrigues Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.3.4 OS:Any
Assigned to: CPU Architecture:Any
Tags: ArgumentOutOfRangeException, logging, QueryNormalizer, regression

[1 Oct 2010 16:35] Yvan Rodrigues
Description:
When logging is enabled in the connection string, a query longer than 300 bytes will cause an ArgumentOutOfRangeException if a pair of matching tokens such as quotes, back-ticks, or brackets cross the 300 byte threshold.

This is a regression of bug #53865 that I reported in May 2010.

How to repeat:
Create a connection with logging enabled.
Issue a long query in which a pair of tokens cross the 300 byte threshold.

The application will crash at QueryNormalizer.cs:328 in ConsumeQuotedToen(char c) because the length passed to string.Substring is too long.

See attached project.

Suggested fix:
@@ -321,7 +321,8 @@ QueryNormalizer.cs
                     escaped = true;
                 pos++;
             }
-            pos++;
+            if (pos < fullSql.Length)
+                pos++;
             if (c == '\'')
                 tokens.Add(new Token(TokenType.String, "?"));
             else
[1 Oct 2010 16:37] Yvan Rodrigues
VS 2008 solution to recreate bug

Attachment: MySqlBugs.zip (application/x-zip-compressed, text), 156.88 KiB.

[22 Oct 2010 19:28] Reggie Burnett
This has been fixed (see bug #57641)

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

Page generated in 0.054 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.