diff options
author | Yi Zhang (CLR) <yizhang82@users.noreply.github.com> | 2017-06-02 09:10:34 -0700 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2017-06-02 18:10:34 +0200 |
commit | 3a6895ebcc29e0ad84bef61a216433e99fda5f6c (patch) | |
tree | 3f208a02733279189334b651e69f930c4dc92f40 /src/utilcode | |
parent | ef4b192c83f7edd90c75d65ba5440327b3f9d276 (diff) | |
download | coreclr-3a6895ebcc29e0ad84bef61a216433e99fda5f6c.tar.gz coreclr-3a6895ebcc29e0ad84bef61a216433e99fda5f6c.tar.bz2 coreclr-3a6895ebcc29e0ad84bef61a216433e99fda5f6c.zip |
Fix a bug in LoadNativeStringResource to honor the contract properly when the buffer is not big enough (#12051)
* Return last error properly
* adjust pcwchUsed if ERROR_INSUFFICIENT_BUFFER
* return hr
* ERROR_INSUFFICIENT_BUFFER is a win32 error....
Diffstat (limited to 'src/utilcode')
-rw-r--r-- | src/utilcode/ccomprc.cpp | 3 | ||||
-rw-r--r-- | src/utilcode/sstring_com.cpp | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp index ed902dc6ca..bc649e7b6e 100644 --- a/src/utilcode/ccomprc.cpp +++ b/src/utilcode/ccomprc.cpp @@ -852,9 +852,8 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iR return hr; #else // !FEATURE_PAL - LoadNativeStringResource(NATIVE_STRING_RESOURCE_TABLE(NATIVE_STRING_RESOURCE_NAME), iResourceID, + return LoadNativeStringResource(NATIVE_STRING_RESOURCE_TABLE(NATIVE_STRING_RESOURCE_NAME), iResourceID, szBuffer, iMax, pcwchUsed); - return S_OK; #endif // !FEATURE_PAL } diff --git a/src/utilcode/sstring_com.cpp b/src/utilcode/sstring_com.cpp index 61cf4dd29b..ada4c9c406 100644 --- a/src/utilcode/sstring_com.cpp +++ b/src/utilcode/sstring_com.cpp @@ -60,7 +60,7 @@ HRESULT SString::LoadResourceAndReturnHR(CCompRC* pResourceDLL, CCompRC::Resourc // In fatal error reporting scenarios, we may not have enough memory to // allocate a larger buffer. - hr = pResourceDLL->LoadString(eCategory, resourceID, GetRawUnicode(), GetRawCount()+1,&size); + hr = pResourceDLL->LoadString(eCategory, resourceID, GetRawUnicode(), GetRawCount()+1, &size); if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) { if (FAILED(hr)) |