From: Paul Gofman pgofman@codeweavers.com
--- dlls/wininet/internet.c | 7 +++++++ dlls/wininet/tests/http.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 764be89189d..17a7ce9385e 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2607,6 +2607,13 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
TRACE("%p %p %ld %p\n", hFile, lpBuffer, dwNumOfBytesToRead, pdwNumOfBytesRead);
+ if (!lpBuffer || !pdwNumOfBytesRead) + { + INTERNET_SetLastError(ERROR_INVALID_PARAMETER); + if (pdwNumOfBytesRead) *pdwNumOfBytesRead = 0; + return FALSE; + } + hdr = get_handle_object(hFile); if (!hdr) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 14c08e0c0ad..bc18986c69f 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -1137,6 +1137,22 @@ static void InternetReadFile_test(int flags, const test_data_t *test) "InternetReadFile should have set last error to ERROR_INVALID_HANDLE instead of %lu\n", GetLastError());
+ SetLastError(0xdeadbeef); + res = InternetReadFile(hor, buffer, 100, NULL); + ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "got res %d, error %lu.\n", res, GetLastError()); + + SetLastError(0xdeadbeef); + length = 0xdeadbeef; + res = InternetReadFile(hor, NULL, 100, &length); + ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "got res %d, error %lu.\n", res, GetLastError()); + ok(!length, "got %lu.\n", length); + + SetLastError(0xdeadbeef); + length = 0xdeadbeef; + res = InternetReadFile(hor, NULL, 0, &length); + ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "got res %d, error %lu.\n", res, GetLastError()); + ok(!length, "got %lu.\n", length); + length = 100; if(winetest_debug > 1) trace("Entering Query loop\n");
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=148925
Your paranoid android.
=== debian11b (64 bit WoW report) ===
kernel32: comm.c:1574: Test failed: AbortWaitCts hComPortEvent failed comm.c:1586: Test failed: Unexpected time 1002, expected around 500
Under some conditions Audiosurf calls InternetReadFile with NULL buffer. This doesn't really help the game as under the same conditions with InternetReadFile validating buffer pointer it crashes right away in its code (also on Windows), yet probably adding the validation won't hurt.
This merge request was approved by Jacek Caban.