smaller type conversion bugs on 32 bit

Bug #1087202 reported by Vladislav Vaintroub on 2012-12-06
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server
Status tracked in 5.6
Laurynas Biveinis
Laurynas Biveinis

Bug Description

There are couple of bugs about conversion of ib_uint64_t types (like LSNs) to size_t-big types. On 32 bit, for big enough values it would mean truncating valuable bits off the value. I used Visual Studio compiler to find the bugs, gcc by default is lax on type conversions, even ones that might result in loss of information.

Also, I found that ut_max inline function was sometimes incorrectly used on 64 bit values - it is defined for ulint values, which is != ib_uint64_t on 32 bit

Finally, there is a warning about truncation of ib_uint64_t to double, in I_S handling (because Field::store(double) was used instead of Field::store(longlong,bool)). I'll attach the patch shortly.

Related branches

Stewart Smith (community): Approve on 2013-01-08
Laurynas Biveinis: Approve on 2013-01-04
Sergei Glushchenko: Pending (g2) requested 2013-01-04
Stewart Smith (community): Approve on 2012-12-17
Sergei Glushchenko: Approve (g2) on 2012-12-11

The patch is against xtradb in MariaDB 5.1.66. I hope it applies to PerconaServer, too

Thanks Vladislav.

All of the truncation_warnings.patch is in the new log tracking feature (not tested on Windows...)

tags: added: contribution
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers