<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJzNVUuP2zYQ_jXyhZAgUZJtHXxYb7zoYhdNkTRom8tiRI4kdmnSICkvnF-foWR7k7TIJYfEoClSfGi-B4etlafNXyoMTGgwPTui88oaVpRZnuUs4es7lNbB-UVaZp0o64Q3Cb9l96y3gYUBWWe1ti-KNngBZ6bngIYJuz8oHbujkeiYF2DSdlRaJuVNkr9J8ptkmc9FWOOtxvltb31I-N3z-MmcUAzqORO0oig41WVJ1eU7sfknBeBUPwRmD-jASGY7inyV1DuqmfIMWA-uhR7ZEfSILKm3wjrMPlBUnTIot8qAO72Ny4N179CPOiT1mzkYxva4F4cTkREi7IQvKbCnAC2FW2_zOLHe0mh77tH-OyYuQ7yhFTesWE6dW_bw4ePv_-xuf7t_eNo-vr19eHp__3EXGS23l-99_xd3T1a71zKtKq7U92giDpTZNxTP3UiXsBLZAUj2yI4_6-evqhQZo_l-bJ_xRI04K3IGWqOcYKyHEA7TfH5HpVdBQ5uR3rFjxqD9l42U_q22LT1WXYnQgBAcuIRCLpuVrHhZF5XsoBFlWy9BtAVZ7E6ruMBgCMQz7fY_nuDlY7EuIsUv0cPRiqWTDFw_7tGECELF-D2STy07M8AndI_v__7VoS2_D03E-A9WmRBlJ3zUj84k0a7uVGS-LeMR2cUAZTYdGWjtcToKdEDxV0NOJ52QkzaDCmcXX7z8NcKrgueT_POBTHFlQ4SxKiMKiAkoprcApBtPpSIBY5YFTXI6OMU0G49bgKDEPJONpOr6KbBv9Sz5nG7mdEKSxg9QygtXRSl69J4ZpFzOlDlafUTP7BhS26WtpUzsM8b-QDfAgZjjZdU01ZrtpwzaUipF_UXyWMhNKZuygQWMYbBuM6Kxi9HpzX84HsYLx1ofL4_04Oy_KCI3yvsRI-E1EbpeDBte8VUDdd5VHKoG81ryWtTdsqoLaNq8WpBqqP1myq7c4AubtqA2YV_8eARqw3NOJS_ydZ3neVatZNMW63Xd1IXIa55UOe5B6Szuk1nXL9xm2rIde0-DWvngXwfBe9UbxClgijCQ76YOkNSnT-ji3dCB9pgerFdBkVpfX0zX2zMe-T1dQiqV-OqWq4lm28xKLyZUmwnSZ91eZ3o>53518</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[analyzer] false-positive garbage value warning with multi-demensional constant array access
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ueno
</td>
</tr>
</table>
<pre>
With clang version 13.0.0 (Fedora 13.0.0-3.fc35), I got the following warning when compiling under scan-build:
```console
gost/kuznyechik.c:112:33: warning: The right operand of '^' is a garbage value [core.UndefinedBinaryOperatorResult]
memcpy(t, &kuz_table[0][(b[0] ^ c[0]) * 16], KUZNYECHIK_BLOCK_SIZE);
^ ~~~~
1 warning generated.
```
The code path is as follows:
1. `subkey` is [called](https://gitlab.com/gnutls/gnutls/-/blob/7f3ea9acc2a2da1d697d423514dfa9c3b56acb15/lib/nettle/gost/kuznyechik.c#L181) with the 3rd argument `i` set to 0
2. `LSX` is [called](https://gitlab.com/gnutls/gnutls/-/blob/7f3ea9acc2a2da1d697d423514dfa9c3b56acb15/lib/nettle/gost/kuznyechik.c#L161) with the 3rd argument `c` pointing to `kuz_key_table[i + 2]`
3. The above [line](https://gitlab.com/gnutls/gnutls/-/blob/7f3ea9acc2a2da1d697d423514dfa9c3b56acb15/lib/nettle/gost/kuznyechik.c#L112) is hit
`kuz_key_table` is [defined](https://gitlab.com/gnutls/gnutls/-/blob/7f3ea9acc2a2da1d697d423514dfa9c3b56acb15/lib/nettle/gost/kuztable.h#L73) as a constant 2-dimensional array (`static const uint8_t kuz_key_table[32][16]`) and the above access never involves out-of-bounds. Perhaps #49948 might be related.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVVtv2zYU_jXyC2FBIi1betBDnCZYkGAd1hbb-hIckUcSF5o0SMqB--t3K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