Bug #93905 Memory corruption (bad allocation) when use xdevapi session\client urls
Submitted: 13 Jan 12:01 Modified: 13 Jan 12:41
Reporter: Vladislav Smetannikov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / C++ Severity:S2 (Serious)
Version:8.0.13 OS:Microsoft Windows (Windows 10 Pro 1809 (10.0.17763 Build 17763.1))
Assigned to: CPU Architecture:x86
Tags: Bad Allocation, string too long

[13 Jan 12:01] Vladislav Smetannikov
Description:
When I pass connection URL to mysqlx::Client or server information to mysqlx::Session - connector are crashing.
Debugging shows, that when string object (with url in case of mysqlx::Client, and host/user/password in case of mysqlx::Session) passes to the "string::Impl::from_utf8" it corrupts for some reason, that cause constructor of "cdk::string" to throw an exception of "bad allocation".

Tested systems (As Virtual Machines in VirtualBox Version 6.0.0 r127566):
- Windows 10 Pro (1809, Build 11763.168) 10.0.17763 N/A Build 17763
- Windows 10 Pro (1809, Build 11763.1) 10.0.17763 N/A Build 17763
As native:
- Windows 10 Enterprise (1709, Build 16299.125) 10.0.16299 N/A Build 16299

Error appears in Debug configuration, application in Release is working fine without any problems.

How to repeat:
Download official MSDN image of Windows 10 Pro (en_windows_10_business_edition_version_1809_updated_sept_2018_x64_dvd_d57f2c0d for e.g.), install Microsoft Visual Studio Enterprise 2017 Version 15.7.5 (VisualStudio.15.Release/15.7.5+27703.2042) and try to run simple application in Debug configuration (x86):

mysqlx::Session sess("<host>", 33060, "<user>", "<port>");

or

mysqlx::Client client("mysqlx://<user>:<password>@<host>/<db>", mysqlx::ClientOption::POOL_MAX_SIZE, 4);
[13 Jan 12:41] Vladislav Smetannikov
Okay, I figured it out, I'm trying to link application in Debug configuration with connector libraries that looks like in Release mode, when I compile connector from sources in Debug configuration - error disappear.