Skip to content

Commit

Permalink
[CRT] Fix buffer-overrun in I10_OUTPUT on MSVC builds
Browse files Browse the repository at this point in the history
This function is totally broken on MSVC builds and the tests are hacked and also broken, so skip them on MSVC builds.
  • Loading branch information
tkreuzer committed Nov 2, 2023
1 parent 6bc9281 commit b63719c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions modules/rostests/winetests/msvcrt/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ static void test_I10_OUTPUT(void)
win_skip("I10_OUTPUT not available\n");
return;
}
if (sizeof(long double) == 8)
{
skip("I10_OUTPUT test is broken on MSVC builds!\n");
return;
}
if (j != 12)
trace("sizeof(long double) = %d on this machine\n", j);

Expand Down
2 changes: 1 addition & 1 deletion sdk/lib/crt/misc/i10output.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int CDECL MSVCRT_I10_OUTPUT(_LDOUBLE ld80, int prec, int flag, struct _I10_OUTPU
char buf[I10_OUTPUT_MAX_PREC+9]; /* 9 = strlen("0.e+0000") + '\0' */
char *p;

memcpy(&ld, &ld80, 10);
memcpy(&ld, &ld80, min(sizeof(ld80), sizeof(ld))); // This is broken on MSVC builds!
d = ld;
TRACE("(%lf %d %x %p)\n", d, prec, flag, data);

Expand Down

0 comments on commit b63719c

Please sign in to comment.