Bug #75374 assign instead of compare
Submitted: 1 Jan 2015 11:13 Modified: 1 Jan 2015 12:41
Reporter: Joshua Rogers Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.7.6 OS:Any
Assigned to: CPU Architecture:Any

[1 Jan 2015 11:13] Joshua Rogers
Description:
/strings/dtoa.c:

2198  if (((word0(&u) & Exp_mask) == Exp_mask && (*decpt= DTOA_OVERFLOW)) ||
2199      (!dval(&u) && (*decpt= 1)))
2200  {

*decpt= 1 and *decpt= DTOA_OVERFLOW should be ==?

How to repeat:
.

Suggested fix:
.
[1 Jan 2015 12:39] MySQL Verification Team
Looks the assumption is that the compiler will short-circuit the boolean expression. Do you have a reason to believe the code is unsafe?
The intention is in a comment, seems legitimate:

/* If infinity, set decpt to DTOA_OVERFLOW, if 0 set it to 1 */
[1 Jan 2015 12:41] Joshua Rogers
No, I just wasn't sure if it was intentional.
Closing.