Bug #67953 Arithmetic Operation Resulted in an Overflow
Submitted: 19 Dec 2012 17:39 Modified: 20 Dec 2012 10:51
Reporter: Kismet Agbasi Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.6.4.0 OS:Windows (Vista SP2)
Assigned to: CPU Architecture:Any

[19 Dec 2012 17:39] Kismet Agbasi
Description:
I'm using Visual Studio 2010 Ultimate to develop a .Net application and I'm getting the following exception whenever I debug my application.  Strangely enough, I had WinXP Pro installed on this very machine from which I developed the application without this error ever coming up.  Now that I've upgraded to Windows Vista SP2 - all of a sudden this exception is coming up.  However, I'm not experiencing the problem on any of my other machines that are running WinXP Pro and Win7 Ultimate respectively.  Could there be a problem with the OS?

Here's the exception text:

************** Exception Text **************
System.OverflowException: Arithmetic operation resulted in an overflow.
   at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.HandleAuthChange(MySqlPacket packet)
   at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
   at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at Customer_Payment_Data_Vault.FormLogin.initiateLogin() in C:\Users\kagbasi\Dropbox\Visual Basic 2010\Customer_Payment_Data_Vault\Customer_Payment_Data_Vault\FormLogin.vb:line 23
   at Customer_Payment_Data_Vault.FormLogin.ButtonLogon_Click(Object sender, EventArgs e) in C:\Users\kagbasi\Dropbox\Visual Basic 2010\Customer_Payment_Data_Vault\Customer_Payment_Data_Vault\FormLogin.vb:line 77
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.PerformClick()
   at Customer_Payment_Data_Vault.FormLogin.TextBoxPassword_KeyDown(Object sender, KeyEventArgs e) in C:\Users\kagbasi\Dropbox\Visual Basic 2010\Customer_Payment_Data_Vault\Customer_Payment_Data_Vault\FormLogin.vb:line 109
   at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
   at System.Windows.Forms.TextBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.296 (RTMGDR.030319-2900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
cpdv
    Assembly Version: 1.0.50.4
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/kagbasi.CENTRALTRUCK/Dropbox/Visual%20Basic%202010/Customer_Payment_Data_Vault/Customer_Payment_Data_Vault/bin/Debug/cpdv.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.296 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.278 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.282 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
MySql.Data
    Assembly Version: 6.6.4.0
    Win32 Version: 6.6.4.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/MySql.Data/v4.0_6.6.4.0__c5687fc88969c44d/MySql.Data.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

How to repeat:
I don't think this can be replicated, as it only happens on the Vista machine.
[19 Dec 2012 23:56] Fernando Gonzalez.Sanchez
Hi,

From the stack trace is clear you are using Connector/NET v6.6, the version dropped support for old password authentication.

This is a duplicate of http://bugs.mysql.com/bug.php?id=66647

>>From bug 66647

To all people who is having this issue, the way to reproduce & fix is as follows:

Create a user with old style authentication, using these SQL as sample:

create user 'oldpassuser'@'localhost'
grant all on *.* to 'oldpassuser'@'localhost'
set password for 'oldpassuser'@'localhost' = old_password( '123' )

Then try to connect with that user in Connector/NET 6.6.2 or later. You will get the "Arithmetic operation resulted in overflow" error.

Now try this SQL to reset the password to the 4.1 authentication style

set password for 'oldpassuser'@'localhost' = password( '123' )

NOTE: While following the previous steps make sure show variables like 'old_passwords' returns 0 (otherwise put it to zero before running this script).

NOTE2: The reason old password support was dropped is because they are insecure and there a documented ways to crack them.
[20 Dec 2012 10:51] Kismet Agbasi
Thanks, but the script you gave wasn't working for me.  So I did the following:

Using MySQL Workbench I

1.  Changed the server variable for old_passwords to 0 by unchecking it.
2.  Deleted the user accounts that had the old 16-byte hashed passwords.
3.  Restarted the server.
4.  Recreated the users - and this time passwords were hashed to 41-bytes.

My application is now able to connect to the database without a problem.  Thanks again.