| Bug #99906 | Got heap-use-after-free error when using asan | ||
|---|---|---|---|
| Submitted: | 17 Jun 2020 2:41 | Modified: | 17 Jun 2020 3:10 |
| Reporter: | Zhang JiYang | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.6.* | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[17 Jun 2020 3:10]
Zhang JiYang
It seems that it happens when setting default value of Sys_var_charptr by my_strdup.

Description: See the following codes, it leads to a heap-use-after-free error from asan, although it does not affect the normal operation of the MySQL. mysys_ssl/my_getopt.cc static void init_one_value(...) { ... my_free(*pstr); *pstr= my_strdup((char*) (intptr) value, MYF(MY_WME)); ... } mysys/my_malloc.c char *my_strdup(const char *from, myf my_flags) { char *ptr; size_t length= strlen(from)+1; if ((ptr= (char*) my_malloc(length, my_flags))) memcpy(ptr, from, length); return ptr; } How to repeat: NULL