-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Milestone
Description
On Windows Visual C++ 'long' is 4-bytes. In /Data/MySQL/src/Binder.cpp (1.5.x) we have the following code:
#ifndef POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const long& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
}
void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
}
#endifSo if POCO_LONG_IS_64_BIT is not defined (i.e. long is 4-bytes, which is the case in Windows MSVC) we bind long values as MYSQL_TYPE_LONGLONG.
However, according to the MySQL documentation here MYSQL_TYPE_LONGLONG is 8 bytes. Therefore if you bind any long values to your statement using use(), it incorrectly interprets these as being 8 bytes wide, and binds to garbage/uninitialized memory.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels