vm.c (stack_copy) check if src is NULL before memcpy(); ref #5777

Because 2nd argument of memcpy() is declared to never be null.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-08-18 08:15:38 +09:00
parent 8c08324d2f
commit d577221c2d
+3 -1
View File
@@ -102,7 +102,9 @@ stack_clear(mrb_value *from, size_t count)
static inline void
stack_copy(mrb_value *dst, const mrb_value *src, size_t size)
{
memcpy(dst, src, sizeof(mrb_value)*size);
if (src) {
memcpy(dst, src, sizeof(mrb_value)*size);
}
}
static void