* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
*/
+#include <config.h>
#include <mono/metadata/object-internals.h>
#include <mono/metadata/verify.h>
#include <ctype.h>
+static MiniVerifierMode verifier_mode = MONO_VERIFIER_MODE_OFF;
+static gboolean verify_all = FALSE;
+
+/*
+ * Set the desired level of checks for the verfier.
+ *
+ */
+void
+mono_verifier_set_mode (MiniVerifierMode mode)
+{
+ verifier_mode = mode;
+}
+
+void
+mono_verifier_enable_verify_all ()
+{
+ verify_all = TRUE;
+}
+
+#ifndef DISABLE_VERIFIER
/*
* Pull the list of opcodes
*/
case MONO_TYPE_VALUETYPE:
/*FIXME handle nullables and enum*/
- return candidate->type == MONO_TYPE_VALUETYPE && target->data.klass == candidate->data.klass;
+ return mono_class_from_mono_type (candidate) == mono_class_from_mono_type (target);
case MONO_TYPE_VAR:
return candidate->type == MONO_TYPE_VAR && mono_type_get_generic_param_num (target) == mono_type_get_generic_param_num (candidate);
if (!verify_stack_type_compatibility (ctx, sig->params[i], value)) {
char *stack_name = stack_slot_full_name (value);
char *sig_name = mono_type_full_name (sig->params [i]);
- CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Incompatible parameter value with function signature: %s X %s at 0x%04x", sig_name, stack_name, ctx->ip_offset));
+ CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Incompatible parameter with function signature: Calling method with signature (%s) but for argument %d there is a (%s) on stack at 0x%04x", sig_name, i, stack_name, ctx->ip_offset));
g_free (stack_name);
g_free (sig_name);
}
if (!verify_stack_type_compatibility (ctx, type, ©))
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Incompatible this argument on stack with method signature at 0x%04x", ctx->ip_offset));
- if (!IS_SKIP_VISIBILITY (ctx) && !mono_method_can_access_method_full (ctx->method, method, value->type->data.klass)) {
+ if (!IS_SKIP_VISIBILITY (ctx) && !mono_method_can_access_method_full (ctx->method, method, mono_class_from_mono_type (value->type))) {
char *name = mono_method_full_name (method, TRUE);
CODE_NOT_VERIFIABLE2 (ctx, g_strdup_printf ("Method %s is not accessible at 0x%04x", name, ctx->ip_offset), MONO_EXCEPTION_METHOD_ACCESS);
g_free (name);
return NULL;
}
-static MiniVerifierMode verifier_mode = MONO_VERIFIER_MODE_OFF;
-static gboolean verify_all = FALSE;
-
-/*
- * Set the desired level of checks for the verfier.
- *
- */
-void
-mono_verifier_set_mode (MiniVerifierMode mode)
-{
- verifier_mode = mode;
-}
-
-void
-mono_verifier_enable_verify_all ()
-{
- verify_all = TRUE;
-}
-
/*
* Returns true if @method needs to be verified.
*
return FALSE;
return TRUE;
}
+#else
+
+gboolean
+mono_verifier_verify_class (MonoClass *class)
+{
+ /* The verifier was disabled at compile time */
+ return TRUE;
+}
+
+GSList*
+mono_method_verify_with_current_settings (MonoMethod *method, gboolean skip_visibility)
+{
+ /* The verifier was disabled at compile time */
+ return NULL;
+}
+
+gboolean
+mono_verifier_is_class_full_trust (MonoClass *klass)
+{
+ /* The verifier was disabled at compile time */
+ return TRUE;
+}
+
+gboolean
+mono_verifier_is_method_full_trust (MonoMethod *method)
+{
+ /* The verifier was disabled at compile time */
+ return TRUE;
+}
+
+gboolean
+mono_verifier_is_enabled_for_image (MonoImage *image)
+{
+ /* The verifier was disabled at compile time */
+ return FALSE;
+}
+
+gboolean
+mono_verifier_is_enabled_for_class (MonoClass *klass)
+{
+ /* The verifier was disabled at compile time */
+ return FALSE;
+}
+
+gboolean
+mono_verifier_is_enabled_for_method (MonoMethod *method)
+{
+ /* The verifier was disabled at compile time */
+ return FALSE;
+}
+
+GSList*
+mono_method_verify (MonoMethod *method, int level)
+{
+ /* The verifier was disabled at compile time */
+ return NULL;
+}
+
+void
+mono_free_verify_list (GSList *list)
+{
+ /* The verifier was disabled at compile time */
+ /* will always be null if verifier is disabled */
+}
+
+GSList*
+mono_image_verify_tables (MonoImage *image, int level)
+{
+ /* The verifier was disabled at compile time */
+ return NULL;
+}
+#endif