Bug #86409 Possible unintended usage of "keyinfo" variable
Submitted: 22 May 2017 15:20 Modified: 5 Sep 2017 1:54
Reporter: Petru-Florin Mihancea Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[22 May 2017 15:20] Petru-Florin Mihancea
Description:
Hi,

While experimenting with a CodeSonar plugin we develop, we noticed a potential bug in file " mysql-server/sql/sql_tmp_table.cc" line 1497:

keyinfo->set_in_memory_estimate(IN_MEMORY_ESTIMATE_UNKNOWN);

Shouldn't you invoke the method on the hash_key variable (instead of keyinfo)?

Thank you.

How to repeat:
This is a bug observed at the source code level.
[23 May 2017 14:10] MySQL Verification Team
Hi!

This time, you could be quite right. Looks to me that those two variables, which are pointers to different structures, could be used depending on other conditions.

In any case, this is worth further analysis.

Verified.
[5 Sep 2017 1:54] Paul DuBois
Posted by developer:
 
Fixed in 5.7.20, 8.0.3.

Code cleanup. No changelog entry needed.
(No incorrect behavior was demonstrated.)