Bug #91520 GCC 8 warning in mysql_client_test.cc
Submitted: 2 Jul 2018 11:55 Modified: 2 Jul 2018 15:50
Reporter: Knut Anders Hatlen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[2 Jul 2018 11:55] Knut Anders Hatlen
Description:
I see the following warning when I build MySQL with GCC 8.1 and -Og:

/code/mysql/trunk/testclients/mysql_client_test.cc: In function ‘void test_mem_overun()’:
/code/mysql/trunk/testclients/mysql_client_test.cc:7842:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Werror=format-overflow=]
     sprintf(field, "c%d int", i);
                    ^~~~~~~~~
/code/mysql/trunk/testclients/mysql_client_test.cc:7842:20: note: directive argument in the range [-2147483648, 999]
/code/mysql/trunk/testclients/mysql_client_test.cc:7842:12: note: ‘sprintf’ output between 7 and 17 bytes into a destination of size 10
     sprintf(field, "c%d int", i);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

How to repeat:
Build MySQL.
[2 Jul 2018 15:50] Paul DuBois
Posted by developer:
 
Fixed in 8.0.13.

Code cleanup. No changelog entry needed.