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

    <tr>
        <th>Summary</th>
        <td>
            Hardening checks should detect dereferencing map.end() and set.end()
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    One of the most common patterns with map and set types is to call `find`, check the iterator against `end()`, and dereference the iterator. If you forget to perform this check, libc++'s hardening mode doesn't seem to catch this and just returns garbage values.

* `std::map`: https://godbolt.org/z/TddKM3r1M
* `set::set`: https://godbolt.org/z/67a61a7n7
* `set::unordered_map`: https://godbolt.org/z/beGesh9j3
* `std::unordered_set`: https://godbolt.org/z/q9q7qrKqj

(CC @danakj)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk09vpDgQxT-NuZSCjE1Dc-DQScTuKor2sveVwQW4Y2zaLhJlPv3IdCaZjHKIhAD5z6_eK71SMZrJIbbscMsO95naaPah1erZ6B5d1nv92v7rEPwINCMsPhIMflm8g1URYXARXgzNsKgVlNMQkYBeV4xgIpCHQVkLrOKjcZpVnIk7GGYcnnacIQyKfAA1KeMipYPoNBNHJpq30wmqMeCIAd2An-7l8M8Ir36D0YcpFfawYhh9WIBmE6-VEsSafmDidn_qCLMKGp1xEyxeI2iP0TFRE0TE5aqahvnKSPXPWyQISFuyO6nQqwnhWdkNY874PeOnt7c4JQuRNJMnJk-LWpMLeYKZaI1pUXRMdJPXvbeU-zAx0f1govtP64dHGYrHzyCkKyj9fA9U1aoqVO3qr0Gb8yF1U___fW09_oVxbs7ya5MfyO-rvDSX-hIeLufP3Tve3QEruVZOPZ2ZaDLdSt3IRmXYFjWv6lIUXGZzW_dS983AG8RRSH08NE1xOFRNrbXQqi8z0wouSl7IQkhelDKXXBWVOsi-HKQ8ioGVHBdlbG7t85KUZSbGDdsjF4XIrOrRxn0qhHD4AvsmEyINSWjTnZt-myIruTWR4geFDFls_34P2B7BCHH2m01BJhzotzzvGVRr_p76X0P0sZJtwbZ_NNTQvPX54BcmulT67XOzBn_GgZjodsGRiW439DMAAP__Dhc6UQ">