Closed ArtSin closed 3 weeks ago
va_arg with type long was used for both int and long arguments, but x86_64 Linux has 64-bit long, so passing an int argument to _mi_vsnprintf results in undefined behaviour. For example, here: https://github.com/microsoft/mimalloc/blob/db3d8485d2f45a6f179d784f602f9eff4f60795c/src/prim/unix/prim.c#L521-L524
va_arg
long
int
_mi_vsnprintf
intptr_t was used as the largest integer type, but on 32-bit systems it is 32-bit wide, while long long is 64-bit. intmax_t can be used instead.
intptr_t
long long
intmax_t
@microsoft-github-policy-service agree company="ISP RAS"
@microsoft-github-policy-service rerun
Great -- thank you so much!
va_arg
with typelong
was used for bothint
andlong
arguments, but x86_64 Linux has 64-bitlong
, so passing anint
argument to_mi_vsnprintf
results in undefined behaviour. For example, here: https://github.com/microsoft/mimalloc/blob/db3d8485d2f45a6f179d784f602f9eff4f60795c/src/prim/unix/prim.c#L521-L524intptr_t
was used as the largest integer type, but on 32-bit systems it is 32-bit wide, whilelong long
is 64-bit.intmax_t
can be used instead.