mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0031008: Application Framework - memcpy-param-overlap reported by Clang address sanitizer in LDOM_XmlReader::ReadRecord()
Use memmove instead of memcpy because of copy of the possible overlapped source and destination parts of the buffer.
This commit is contained in:
parent
2724a0b3cc
commit
3358ed643b
@ -120,7 +120,10 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
|
|||||||
}
|
}
|
||||||
// Copy the rest of file data to the beginning of buffer
|
// Copy the rest of file data to the beginning of buffer
|
||||||
if (aBytesRest > 0)
|
if (aBytesRest > 0)
|
||||||
memcpy (&myBuffer[0], myPtr, aBytesRest);
|
{
|
||||||
|
// do not use memcpy here because aBytesRest may be greater than myPtr-myBuffer, so, overlap
|
||||||
|
memmove (&myBuffer[0], myPtr, aBytesRest);
|
||||||
|
}
|
||||||
|
|
||||||
// Read the full buffer and reset start and end buffer pointers
|
// Read the full buffer and reset start and end buffer pointers
|
||||||
myPtr = &myBuffer[0];
|
myPtr = &myBuffer[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user