aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
diff options
context:
space:
mode:
authorHans <hans@hanshq.net>2024-09-22 19:05:20 +0200
committerGitHub <noreply@github.com>2024-09-22 19:05:20 +0200
commit9f3d083c4963fcd164fc48e326e5967e6395f28a (patch)
tree1c0e7138c8c744c5c34791f7aed59b5cd8c201c2 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
parentd84411f686e7755c620c93d77c5f6adba88d28a5 (diff)
downloadllvm-9f3d083c4963fcd164fc48e326e5967e6395f28a.zip
llvm-9f3d083c4963fcd164fc48e326e5967e6395f28a.tar.gz
llvm-9f3d083c4963fcd164fc48e326e5967e6395f28a.tar.bz2
[win/asan] Ensure errno gets set correctly for strtol (#109258)
This fixes two problems with asan's interception of `strtol` on Windows: 1. In the dynamic runtime, the `strtol` interceptor calls out to ntdll's `strtol` to perform the string conversion. Unfortunately, that function doesn't set `errno`. This has been a long-standing problem (#34485), but it was not an issue when using the static runtime. After the static runtime was removed recently (#107899), the problem became more urgent. 2. A module linked against the static CRT will have a different instance of `errno` than the ASan runtime, since that's now always linked against the dynamic CRT. That means even if the ASan runtime sets `errno` correctly, the calling module will not see it. This patch fixes the first problem by making the `strtol` interceptor call out to `strtoll` instead, and do 32-bit range checks on the result. I can't think of any reasonable way to fix the second problem, so we should stop intercepting `strtol` in the static runtime thunk. I checked the list of functions in the thunk, and `strtol` and `strtoll` are the only ones that set `errno`. (`strtoll` was already missing, probably by mistake.)
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h')
0 files changed, 0 insertions, 0 deletions