mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #2383] winhttp_offline: an empty server name and a context option of the wrong size fail as on the host (WINHTTP-ARG-CHECKS) #2385
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2385
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2383
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/winhttp-arg-checks📝 Commits (1)
f8ebd9dwinhttp_offline: an empty server name and a context option of the wrong size fail as on the host (WINHTTP-ARG-CHECKS)📊 Changes
2 files changed (+19 additions, -2 deletions)
View changed files
📝
runtime/shims/winhttp_offline.cpp(+4 -2)📝
runtime/test/winhttp_offline_test.cpp(+15 -0)📄 Description
Claimed in the coordination issue as: WINHTTP-ARG-CHECKS
What and why
I compared the offline WinHTTP shim with the host's
winhttp.dllon the calls that need no network: handles, options, timeouts and the argument checks. A small ctypes probe ran on Windows 11 against.invalidnames, with no request sent. Two answers differ:winhttp.dllmainWinHttpConnect(session, L"", 80, 0)ERROR_WINHTTP_INVALID_URL(12005)ERROR_INVALID_PARAMETER(87)WinHttpConnect(session, nullptr, 80, 0)ERROR_INVALID_PARAMETERERROR_INVALID_PARAMETERWinHttpSetOption(h, WINHTTP_OPTION_CONTEXT_VALUE, buf, 4)ERROR_INSUFFICIENT_BUFFERERROR_INSUFFICIENT_BUFFERWinHttpSetOption(h, WINHTTP_OPTION_CONTEXT_VALUE, buf, 16)ERROR_INSUFFICIENT_BUFFEREverything else in the probe already matched:
WinHttpConnecton a connect handle andWinHttpOpenRequeston a session (ERROR_WINHTTP_INCORRECT_HANDLE_TYPE);WinHttpCloseHandleofNULLand of a closed handle;NULLhandle.Both are fixed: an empty server name now fails with
ERROR_WINHTTP_INVALID_URL, and the context option takes exactlysizeof(DWORD_PTR)and leaves the handle's context as it was otherwise.Not changed: the shim still accepts options it does not know (the host refuses an unknown option number with
ERROR_WINHTTP_INVALID_OPTION). The file's header says options are accepted on purpose, and matching the host there would need the host's list of options per handle type.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
winhttp_offline_testgets three checks: a 16-byte context value fails withERROR_INSUFFICIENT_BUFFER, the context set before it stays, and an empty server name fails withERROR_WINHTTP_INVALID_URL.main: 3 of 86 checks fail.scripts/pr_overlap.pyfrom #2349).scripts/check_no_game_data.pyon both files.Not tested under Wine.
GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.