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

    <tr>
        <th>Summary</th>
        <td>
            [libc] Make malloc resistant to overflow
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

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

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

<pre>
    The malloc implmentation in libc has been only spoaradically careful to prevent overflow, but it hasn't been systematically careful. It should be the case that no value provided to any surface area of the allocator (the allocation functions, `_end`, and `__llvm_libc_heap_limit`) can cause it to produce erroneous behavior due to overflow. Tests should be added for the various possible overflow corner cases, checks added to secure against this possibility, and any spurious checks removed.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxUUsGOmzAQ_RpzGW0ETiDhwKHtKlIPve09GswQ3DU28oyp-PvKbHabnjD2vDfvPT1ktndP1Kn6u9J63lgobjPKpLRW9WuBSaYQu6eHog_D1r1NBDM6FwzYeXEzeUGxwYP14GxvYEKGnshD8G4DXgJGHKxB5zYwGGlMDiTAEmklLxBWiqMLf5T-AX0SsJIZvNJn-aDhrGBG-Z_iAD8FeArJDdATyERgkPMBBXyAFV0iWGJY7UBDXoh-A05xREOAkRDCuMN2LyghgtKXp4vsaUze5ANndaopb-QH1ZT5D_2w39ycW-dbdn6bCJebs7OVfaYFgx4MJqbsavcchmQIKMbgKaQc1ISrDRGGRHniM40DvBELPznEIfsYQ9xFrxhtxi-B2faOvoBgQvQU9zB21WYi884PuARgMikS4B2tZwGZ7CeLdVa2T2t7Wkv62PLgiDSHlYZDMXTHoT22WFBXnY_NpdVNeS6mrh_7quypLptmrDTiZWwbMu3xZMypb01d2E6Xui6r6qR1VZbnA9XmXJ7rpjd1VTXlRZ1KmtG6Q071EOK9sMyJukrr9nwpHPbk-NHZnPmjrLHL8y99urM6lc6y8D8GseL2nu-A-hV-4ftXhyOxZUEvz-kXKbpuEllYHb8pfVX6ercypf5gwqz0NVM_Pi9LDL_JiNLXXSkrfX2IXTv9NwAA__-_nCy8">