Fixed `std::vector::data` return type (#5116)
This caused many `arithOperationsOnVoidPointer` false positives in my project which uses `std::vector<uint8_t>` in many places.
This commit is contained in:
parent
34cecf2336
commit
93595aeff0
|
@ -6773,7 +6773,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<function name="std::array::data,std::vector::data,std::span::data">
|
||||
<use-retval/>
|
||||
<const/>
|
||||
<returnValue type="void *"/>
|
||||
<returnValue type="const T *"/>
|
||||
<noreturn>false</noreturn>
|
||||
</function>
|
||||
<!-- https://en.cppreference.com/w/cpp/container/deque/swap -->
|
||||
|
|
|
@ -4739,4 +4739,11 @@ void smartPtr_release()
|
|||
p.release();
|
||||
//cppcheck-suppress nullPointer
|
||||
*p = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void std_vector_data_arithmetic()
|
||||
{
|
||||
std::vector<char> buf;
|
||||
buf.resize(1);
|
||||
memcpy(buf.data() + 0, "", 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue