[metadata] Fix crash related to custom attributes (#10739)
commit5fa2df8b4d4a4c5178d1931a780910314f8125f9
authorEberhard Beilharz <ermshiperete@users.noreply.github.com>
Fri, 19 Oct 2018 11:03:25 +0000 (19 13:03 +0200)
committerLudovic Henry <luhenry@microsoft.com>
Fri, 19 Oct 2018 11:03:25 +0000 (19 07:03 -0400)
treec6615b424c85aaa2fb98c9f4c858a8ebf436f32b
parentaa5438dd5d3bdc156ced00f5c7d158e0b026651a
[metadata] Fix crash related to custom attributes (#10739)

* [tests] Renumber duplicate return codes

* [metadata] Fix crash related to custom attributes (#10737)

When a class doesn't contain the desired custom attribute we used
to return the last available attribute. This prevented
`cominterop_ccw_queryinterface()` to detect that the interface
isn't implemented and lead to a crash.

This change fixes #10737.

* [cominterop] Switch to GC Unsafe in IUnknown and IDispatch impls

These methods can be called directly from embedding APIs.
mono/metadata/cominterop.c
mono/metadata/custom-attrs.c
mono/tests/cominterop.cs
mono/tests/libtest.c