Cleared UBsan error on non-null pointers being used with memcpy and memmove from library functions memcpy_s and memmove_s
parent
134ba3e16b
commit
5f299d76a0
8
misc.h
8
misc.h
|
|
@ -174,6 +174,10 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou
|
|||
{
|
||||
if (count > sizeInBytes)
|
||||
throw InvalidArgument("memcpy_s: buffer overflow");
|
||||
|
||||
// TODO: fix callers. Its easier than it sounds because of the way
|
||||
// Put and Put2 are used in filters.
|
||||
if(dest && src && count)
|
||||
memcpy(dest, src, count);
|
||||
}
|
||||
|
||||
|
|
@ -181,6 +185,10 @@ inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t co
|
|||
{
|
||||
if (count > sizeInBytes)
|
||||
throw InvalidArgument("memmove_s: buffer overflow");
|
||||
|
||||
// TODO: fix callers. Its easier than it sounds because of the way
|
||||
// Put and Put2 are used in filters.
|
||||
if(dest && src && count)
|
||||
memmove(dest, src, count);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue