<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/79685>79685</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang/lib/Format/WhitespaceManager.cpp:1472: Sanity check after use ?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dcb314
      </td>
    </tr>
</table>

<pre>
    Static analyser cppcheck says:

clang/lib/Format/WhitespaceManager.cpp:1472:23: style: Array index 'j' is used before limits check. [arrayIndexThenCheck]

Source code is

       while (Changes[j].Tok != NextNonComment && j < End)

Sanity check before use would be more usual.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycUs1upDwQfJrm0gqCNubnwGEy8yF9h80lkfZsTA94YjCyTZJ5-xUziTa5LgdstV2uqu5SIZhxYW5BPoI8JWqLk_PtoHuRF0nvhmv7HFU0GtWi7DWwR72uemL9ikFdA4gDZCfIPv_aqmUE6qzpgbrO-VlFoO73ZCKHVWn-pRY1sk_1uoI45EVFIA4kQBwwxKvlfXPwXl3RLAN_IFB1AarQBNwCD9jz2XlGa2YTA950pAjyUe2Y_3fIy8TLca-DPH2X9uw2rxm1GxhN-H6C9-99MpYRqD5Oahk5gHy8gDylL-4VgXIQJ3zij_jklqObZ14iApVAJV4QxBH_Wwag5gejWky83kV-Cd8C47vb7O4E53tlUza9I5KhFUMjGpVwm1dZKYo6pzyZ2rMupBS65iHX5-acDyTLsi-5argesrpPTEsZFVlOVdYISXla6qKvz9xkqqmrXNZQZDwrY1Nr3-bU-TExIWzcVk1Zy8Sqnm24hYDoc4i058G3-_2HfhsDFJk1IYa_L0QTLbf_NnP80R11juxvzQHRJZu37RTjeksXdUDdaOK09al2805k376Wh9W7C-ud72YnAHU3R38CAAD__xFu4pU">