diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-21 11:45:38 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-21 11:45:38 +0000 |
commit | d51ac46315b27dec43d52cbaf8fe5257c9c499ce (patch) | |
tree | f1d2a2686d01bbb97fe3ed79b0ae8bb99bc2391b /base/win/iat_patch_function.h | |
parent | 66667aaea174c9cb6c557aee35e78417a2eed3b2 (diff) | |
download | chromium_src-d51ac46315b27dec43d52cbaf8fe5257c9c499ce.zip chromium_src-d51ac46315b27dec43d52cbaf8fe5257c9c499ce.tar.gz chromium_src-d51ac46315b27dec43d52cbaf8fe5257c9c499ce.tar.bz2 |
Expose original_function in IATPatchFunction and use that to set g_iat_orig_duplicate_handle
Previously, the code would initialize g_iat_orig_duplicate_handle like this,
before patching the IAT:
g_iat_orig_duplicate_handle = ::DuplicateHandle;
However, there is no guarantee that this actually ends up storing the
original function pointer from the IAT. It could also just store the
address of the thunk.
Or, in the case of Clang, ::DuplicateHandle would get constant propagated
to the call site that used g_iat_orig_duplicate_handle, which would then end
up calling the patched ::DuplicateHandle and not the original one.
The best way to get the address of the unpatched function is to get it from
IATPatchFunction itself.
BUG=82385
Review URL: https://codereview.chromium.org/205033009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win/iat_patch_function.h')
-rw-r--r-- | base/win/iat_patch_function.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/base/win/iat_patch_function.h b/base/win/iat_patch_function.h index 3ae1f3c..5026e0e 100644 --- a/base/win/iat_patch_function.h +++ b/base/win/iat_patch_function.h @@ -57,6 +57,8 @@ class BASE_EXPORT IATPatchFunction { return (NULL != intercept_function_); } + void* original_function() const; + private: HMODULE module_handle_; void* intercept_function_; |