mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-09-06 18:38:34 +00:00
Fix parameter check in bFile::safeSwapPtr
If either the source or destination pointers are nullptr, we shouldn't continue otherwise we dereference nullptr or memcpy with nullptr which is undefined. (Also move the check to return as soon as possible.)
This commit is contained in:
@@ -851,12 +851,12 @@ void bFile::swapData(char *data, short type, int arraySize, bool ignoreEndianFla
|
||||
|
||||
void bFile::safeSwapPtr(char *dst, const char *src)
|
||||
{
|
||||
if (!src || !dst)
|
||||
return;
|
||||
|
||||
int ptrFile = mFileDNA->getPointerSize();
|
||||
int ptrMem = mMemoryDNA->getPointerSize();
|
||||
|
||||
if (!src && !dst)
|
||||
return;
|
||||
|
||||
if (ptrFile == ptrMem)
|
||||
{
|
||||
memcpy(dst, src, ptrMem);
|
||||
|
||||
Reference in New Issue
Block a user