| Bug #86867 | Possible access to unintended function in "sql/item_timefunc.cc" line 2762 | ||
|---|---|---|---|
| Submitted: | 29 Jun 2017 10:44 | Modified: | 29 Jun 2017 15:43 |
| Reporter: | Petru-Florin Mihancea | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
| Version: | OS: | Any | |
| Assigned to: | CPU Architecture: | Any | |
[29 Jun 2017 15:43]
MySQL Verification Team
Hi ! Thank you for your bug report. For your clear and direct question I am providing you with clear and direct answer. No, it was not the intention to access datetime_precision() for args[1] as well. It was not the intention, because the second argument is a time argument. You can read about it here: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_addtime Thank you for your report.

Description: While experimenting with a CodeSonar plugin we develop, we noticed a potential issue in file "mysql-server/sql/item_timefunc.cc" line 2762 function Item_func_add_time::fix_length_and_dec else if (args[0]->is_temporal_with_date_and_time() || is_date) { cached_field_type= MYSQL_TYPE_DATETIME; /*2762*/ uint8 dec= MY_MAX(args[0]->datetime_precision(), args[1]->time_precision()); fix_length_and_dec_and_charset_datetime(MAX_DATETIME_WIDTH, dec); } Wasn't the intention to access datetime_precision() for args[1] also? Thank you. Petru-Florin Mihancea How to repeat: The issue has been detected automatically via static analysis.