Re: [PATCH v6 0/1] MR10174: bcryptprimitives: Make ProcessPrng always return `TRUE`
On Tue Feb 24 15:53:32 2026 +0000, Paul Gofman wrote:
At very least, that could maybe use some test, if there are reasons why it is useful which I am missing. What will happen on Windows if the buffer is invalid (or unaligned) pointer, if buffer is NULL, if size is ~0u? Will it cause access violation, program abort without exception or maybe will just fail with an error? Testing on Windows, it causes an access violation if the buffer is NULL or otherwise not writeable. I've not found any other cases that fail. It works on bytes so alignment isn't an issue.
Looking at the implementation of `get_random` in https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/ntdll/unix/system.c#L..., it doesn't look like the wine implementation can fail either except if the buffer is NULL. The only place I can see that returns an error is: https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/ntdll/unix/system.c#L... ```c len = peb->NumberOfProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION); if (size >= len) { if (!info) ret = STATUS_ACCESS_VIOLATION; else get_random( info, len ); } ``` The `if (size >= len)` check in that function will trivially succeed because the `fill_random_buffer` function ensures that `size` is small enough. And if `NtQuerySystemInformation` returns successfully then every other function up the chain will return successfully too. So it seems the behaviour is aligned with Windows except for that NULL check. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10174#note_130382
participants (1)
-
Christopher Denton (@cdenton)