diff options
author | Jeremy Koritzinsky <jkoritzinsky@gmail.com> | 2019-02-06 13:05:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-06 13:05:28 -0800 |
commit | 2f88f32ffb6752c89e6751b4747f1b9cd971304d (patch) | |
tree | 16a5e8e49cbb2d50df37a3d3b6f219de75f28c28 /src/vm/ilmarshalers.h | |
parent | d5e903e7f8e881ef9fa8840df863422df4a7c62e (diff) | |
download | coreclr-2f88f32ffb6752c89e6751b4747f1b9cd971304d.tar.gz coreclr-2f88f32ffb6752c89e6751b4747f1b9cd971304d.tar.bz2 coreclr-2f88f32ffb6752c89e6751b4747f1b9cd971304d.zip |
Throw an exception when passing strings by-value as out parameters. (#21513)
* Throw an exception when passing strings by-value as out parameters.
* Fix encoding
* Don't use override in this PR.
* Clean up Marshal_In
Marshal_In was copied back into existence from Marshal_InOut. Clean it up a bit.
* Remove extraneous whitespace.
* Fix failing test.
* Remove out attribute in COM string tests.
* Add back attribute and check for exception thow in COM tests.
* Add block comment to explain the implementation of Reverse_LPWStr_OutAttr in the NETServer.
* Only throw in a CLR->Native marshalling situation.
* Fix asserts from changed code-paths used in ILWSTRMarshaler.
* Add comment and explicitly load in a null value (instead of leaving it uninitialized).
* Apply suggestions from code review
Co-Authored-By: jkoritzinsky <jkoritzinsky@gmail.com>
Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
Diffstat (limited to 'src/vm/ilmarshalers.h')
-rw-r--r-- | src/vm/ilmarshalers.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vm/ilmarshalers.h b/src/vm/ilmarshalers.h index 1c58c0c2a7..3f2c16b4d5 100644 --- a/src/vm/ilmarshalers.h +++ b/src/vm/ilmarshalers.h @@ -1946,7 +1946,7 @@ class ILWSTRMarshaler : public ILMarshaler public: enum { - c_fInOnly = TRUE, + c_fInOnly = FALSE, c_nativeSize = sizeof(void *), c_CLRSize = sizeof(OBJECTREF), }; @@ -1961,6 +1961,18 @@ public: } #endif // _DEBUG + + virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID) + { + if (IsOut(dwMarshalFlags) && !IsByref(dwMarshalFlags) && IsCLRToNative(dwMarshalFlags)) + { + *pErrorResID = IDS_EE_BADMARSHAL_STRING_OUT; + return false; + } + + return true; + } + protected: virtual LocalDesc GetNativeType(); virtual LocalDesc GetManagedType(); @@ -1972,7 +1984,6 @@ protected: virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit); virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit); - virtual void EmitConvertSpaceAndContentsNativeToCLR(ILCodeStream* pslILEmit); virtual bool NeedsClearNative(); virtual void EmitClearNative(ILCodeStream* pslILEmit); |