- switch (token & 0xff000000) {
- case MONO_TOKEN_TYPE_DEF:
- case MONO_TOKEN_TYPE_REF:
- case MONO_TOKEN_TYPE_SPEC:
- case MONO_TOKEN_FIELD_DEF:
- case MONO_TOKEN_METHOD_DEF:
- case MONO_TOKEN_METHOD_SPEC:
- case MONO_TOKEN_MEMBER_REF:
- if (!token_bounds_check (ctx->image, token)) {
- ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Table index out of range 0x%x for token %x for ldtoken at 0x%04x", mono_metadata_token_index (token), token, ctx->ip_offset));
+ if (ctx->method->wrapper_type != MONO_WRAPPER_NONE) {
+ handle = mono_method_get_wrapper_data (ctx->method, token);
+ handle_class = mono_method_get_wrapper_data (ctx->method, token + 1);
+ if (handle_class == mono_defaults.typehandle_class)
+ handle = &((MonoClass*)handle)->byval_arg;
+ } else {
+ switch (token & 0xff000000) {
+ case MONO_TOKEN_TYPE_DEF:
+ case MONO_TOKEN_TYPE_REF:
+ case MONO_TOKEN_TYPE_SPEC:
+ case MONO_TOKEN_FIELD_DEF:
+ case MONO_TOKEN_METHOD_DEF:
+ case MONO_TOKEN_METHOD_SPEC:
+ case MONO_TOKEN_MEMBER_REF:
+ if (!token_bounds_check (ctx->image, token)) {
+ ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Table index out of range 0x%x for token %x for ldtoken at 0x%04x", mono_metadata_token_index (token), token, ctx->ip_offset));
+ return;
+ }
+ break;
+ default:
+ ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Invalid table 0x%x for token 0x%x for ldtoken at 0x%04x", mono_metadata_token_table (token), token, ctx->ip_offset));