<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107789>107789</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
span does not check or null on construction in hardening modes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
beached
</td>
</tr>
</table>
<pre>
The following code in hardening does not check that the range is valid when it can. null, 0 is valid but null, N > 0 is UB
```cpp
int main( ) {
constexpr int * p = nullptr;
return foo( std::span<int>(p, 5) );
}
```
should error with a check that if It is null, size == 0
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcUs2O2zwMfBr6QmygSHYcH3TIbjbAd_lO7QPIEh2pVSRDkpO2T1_Iyf50AcMCSA45Q47K2Z0DkYTuGbpjo5ZiY5IjKW3JNGM0v-U3SzhF7-PNhTPqaAhdQKuSoVAjJlLGEAtqS_onFqsKFkuYVDgTuoxX5Z3Bm6WArqBWYYMYFu-BvyD7KBiX8h7-H0G83pPfn4EdgR0e_x27f3qe7xEXCl6UC8D3CHxA6B8AREQdQy70a05Yy4AfcEYQx3XOXBKIt9pEZUkBpxhrn1wMiAOIQ55VAPHiQgHxCnw_V3LdOoYP72joj1_Y4WfO2cbFG6SUYsKbKxbV5125Cf8rVemb-Oz-UGVZiTJsjBRmEINqSG573u1bxvjQWNmanpttr7Y0DEy3ZhK63W13Y8923TDpqXGSM96ygQ2MVcymG1Q_CdFPqp94pwW0jC7K-Y3318smpnPjcl5Iblnf74fGq5F8Xq3BeaAbrlngvDolyQp6GpdzhpZ5l0v-aFNc8STr8r66I6ZVJsZwv01adHEx_OuoSzSUmyV5aUuZcz0FPwE_nV2xy7jR8QL8VIc9nqc5xR-kC_DTSjEDPz00XCX_GwAA___FK-OO">