<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55335>55335</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ASAN in clang trunk misses a buffer-overflow in struct
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
shao-hua-li
</td>
</tr>
</table>
<pre>
For the following code, `clang-trunk -fsanitize=address -O0` missed the buffler-overflow in `e[1].b`. Interestintly, if you change if to `e[1].d`, asan could detect it then.
```c
struct a {
int b;
int c[3];
int d
} static e[1];
int h() {
int i = e[1].b; // e[1].d however could be detected
return i;
}
int main() {
__builtin_printf("%d\n", h());
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtUl2P2yAQ_DX4ZWXLhjjnPPghHzqpL-1Df0CEYR3TEogA3yn99V2cS9I7VUKyF4aZ2WEHr6_9qw-QJoTRW-vfjTuB8hoZ3wNb18pKdypTmN1vKMconUnmDzJxkFoHjBHKHzXB4GxiRL3wDPM4Wgylf8MwEiMYl5mQtbuGtYdqoKKCby4hESTjkr1mMTPC1c-gJhLEXCX_6ZqmIuMkmSCHs9WgMaFKYFLWdRWrD6zeZtiy1K2OZJ5AEtjL7rYD5CjBwMSnWpGQIKEv2_qD9eUAMclkFNwdPYAZNjHeMb7JInC_fiMwQGnBP92LHQDjr7Seuxom_44U2EdnA340h_rJFjDNwYF5CJOpp4OzNO6_Jo7HYTaWgj5eAgHHBcQZbzVr92753d_95_Xo_0H_iLTQvdAbsZFFMsliv_25_Z6fd5kSuE3JMgmR8s5z8GUMbm9RzMH2U0qXyMT2lsTJpGkeKuXPVFj7dv-Ul-B_UQxUEu2MkX7aVoi2mPpOyWbFR8nrTnAlaqGaWjS4HrpurTs1FlYOaGNPGVOTDslBpsgNt4fC9LzmvG7rrhEN8VSqWdFMb3grRly3SrJVjZSprbKPyodTEfrF0jCfIh1aE1N8HsoYzckhLnLEL-c0-dDHSfpymmVpTbHI94v9v_0cBvw">