Bug #115551 | comp_err hits AddressSanitizer: stack-buffer-overflow | ||
---|---|---|---|
Submitted: | 10 Jul 2024 1:09 | Modified: | 27 Jul 2024 0:12 |
Reporter: | david zhang | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | ASAN build |
[10 Jul 2024 1:09]
david zhang
[10 Jul 2024 9:05]
MySQL Verification Team
Hello david zhang, Thank you for the report and feedback. Could you please share exact make options used for the build, OS details etc.? Thank you. regards, Umesh
[10 Jul 2024 17:54]
david zhang
relevant args to cmake -DWITH_ASAN=1-DWITH_DEBUG=1 I believe this issue is not specific to any OS/CPU Arch. But for completeness we're using Linux, x86, devtoolset-7 It is worth noting that we triggered ASAN due to a long error message we added in our branch. in comp_err.cc buff is stack allocated to 1000 chars. with typical short error messages this condition is never detected. see below: static int parse_input_file(const char *file_name, struct errors **top_error, struct languages **top_lang) { FILE *file; char *str, buff[1000];
[25 Jul 2024 13:30]
MySQL Verification Team
Hello David zhang, Thank you for the feedback. I'm not able to reproduce on any platforms(with ASAN builds), unless I make changes to share/messages_to_*.txt files. Verifying for now so that dev's can take a call on this. Could you please confirm exact version where you were seeing this? Thank you. Looking at the recent source https://github.com/mysql/mysql-server/blame/596f0d238489a9cf9f43ce1ff905984f58d227b6/utili... there was a temp fix to avoid issue on few platforms(char *str, buff[2000];). regards, Umesh
[27 Jul 2024 0:12]
david zhang
increasing buff size is a work-around which fools ASAN but the root cause are the length calculations in memmove() I suggest undo the work-around to expose the issue cleanly.