Prevent dangerous bug
In the non-x86 version of memcopy, the lack of braces made seemingly conditional statements run unconditionally, potentially causing segfaults.
This commit is contained in:
parent
cf7d2e06ee
commit
f5094be285
9
gb.h
9
gb.h
|
@ -3798,13 +3798,16 @@ gb_inline void *gb_memcopy(void *dest, void const *source, isize n) {
|
||||||
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
||||||
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
||||||
}
|
}
|
||||||
if (n & 4)
|
if (n & 4) {
|
||||||
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
*d++ = *s++; *d++ = *s++; *d++ = *s++; *d++ = *s++;
|
||||||
if (n & 2)
|
}
|
||||||
|
if (n & 2) {
|
||||||
*d++ = *s++; *d++ = *s++;
|
*d++ = *s++; *d++ = *s++;
|
||||||
if (n & 1)
|
}
|
||||||
|
if (n & 1) {
|
||||||
*d = *s;
|
*d = *s;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return dest;
|
return dest;
|
||||||
|
|
Loading…
Reference in New Issue