Revert 5aa30f3694995b7695ca5b508af48010fa05465c
Former-commit-id: a0b11a702e5443c9006a1539af249b7af2ca9181
This commit is contained in:
parent
593e959b7c
commit
92b6a55c8e
227
debian/patches/fix_gacutil.patch
vendored
Normal file
227
debian/patches/fix_gacutil.patch
vendored
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c
|
||||||
|
index 9b73ccd..579b93a 100644
|
||||||
|
--- a/mono/metadata/appdomain.c
|
||||||
|
+++ b/mono/metadata/appdomain.c
|
||||||
|
@@ -1927,20 +1927,6 @@ mono_domain_assembly_search (MonoAssemblyName *aname,
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static gboolean
|
||||||
|
-prevent_running_reference_assembly (MonoAssembly *ass, MonoError *error)
|
||||||
|
-{
|
||||||
|
- mono_error_init (error);
|
||||||
|
- gboolean refasm = mono_assembly_get_reference_assembly_attribute (ass, error);
|
||||||
|
- if (!is_ok (error))
|
||||||
|
- return TRUE;
|
||||||
|
- if (refasm) {
|
||||||
|
- mono_error_set_bad_image (error, ass->image, "Could not load file or assembly or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context.\n");
|
||||||
|
- return TRUE;
|
||||||
|
- }
|
||||||
|
- return FALSE;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
MonoReflectionAssembly *
|
||||||
|
ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean refOnly)
|
||||||
|
{
|
||||||
|
@@ -1949,40 +1935,37 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean re
|
||||||
|
MonoDomain *domain = mono_domain_get ();
|
||||||
|
char *name, *filename;
|
||||||
|
MonoImageOpenStatus status = MONO_IMAGE_OK;
|
||||||
|
- MonoAssembly *ass = NULL;
|
||||||
|
-
|
||||||
|
- name = NULL;
|
||||||
|
- result = NULL;
|
||||||
|
-
|
||||||
|
- mono_error_init (&error);
|
||||||
|
+ MonoAssembly *ass;
|
||||||
|
|
||||||
|
if (fname == NULL) {
|
||||||
|
- mono_error_set_argument_null (&error, "assemblyFile", "");
|
||||||
|
- goto leave;
|
||||||
|
+ MonoException *exc = mono_get_exception_argument_null ("assemblyFile");
|
||||||
|
+ mono_set_pending_exception (exc);
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = filename = mono_string_to_utf8_checked (fname, &error);
|
||||||
|
- if (!is_ok (&error))
|
||||||
|
- goto leave;
|
||||||
|
+ if (mono_error_set_pending_exception (&error))
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
ass = mono_assembly_open_full (filename, &status, refOnly);
|
||||||
|
|
||||||
|
if (!ass) {
|
||||||
|
+ MonoException *exc;
|
||||||
|
+
|
||||||
|
if (status == MONO_IMAGE_IMAGE_INVALID)
|
||||||
|
- mono_error_set_bad_image_name (&error, name, "");
|
||||||
|
+ exc = mono_get_exception_bad_image_format2 (NULL, fname);
|
||||||
|
else
|
||||||
|
- mono_error_set_exception_instance (&error, mono_get_exception_file_not_found2 (NULL, fname));
|
||||||
|
- goto leave;
|
||||||
|
+ exc = mono_get_exception_file_not_found2 (NULL, fname);
|
||||||
|
+ g_free (name);
|
||||||
|
+ mono_set_pending_exception (exc);
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!refOnly && prevent_running_reference_assembly (ass, &error))
|
||||||
|
- goto leave;
|
||||||
|
+ g_free (name);
|
||||||
|
|
||||||
|
result = mono_assembly_get_object_checked (domain, ass, &error);
|
||||||
|
-
|
||||||
|
-leave:
|
||||||
|
- mono_error_set_pending_exception (&error);
|
||||||
|
- g_free (name);
|
||||||
|
+ if (!result)
|
||||||
|
+ mono_error_set_pending_exception (&error);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2017,11 +2000,6 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!refonly && prevent_running_reference_assembly (ass, &error)) {
|
||||||
|
- mono_error_set_pending_exception (&error);
|
||||||
|
- return NULL;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
refass = mono_assembly_get_object_checked (domain, ass, &error);
|
||||||
|
if (!refass)
|
||||||
|
mono_error_set_pending_exception (&error);
|
||||||
|
@@ -2039,7 +2017,7 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoString *assRef,
|
||||||
|
MonoAssembly *ass;
|
||||||
|
MonoAssemblyName aname;
|
||||||
|
MonoReflectionAssembly *refass = NULL;
|
||||||
|
- gchar *name = NULL;
|
||||||
|
+ gchar *name;
|
||||||
|
gboolean parsed;
|
||||||
|
|
||||||
|
g_assert (assRef);
|
||||||
|
@@ -2048,13 +2026,16 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoString *assRef,
|
||||||
|
if (mono_error_set_pending_exception (&error))
|
||||||
|
return NULL;
|
||||||
|
parsed = mono_assembly_name_parse (name, &aname);
|
||||||
|
+ g_free (name);
|
||||||
|
|
||||||
|
if (!parsed) {
|
||||||
|
/* This is a parse error... */
|
||||||
|
if (!refOnly) {
|
||||||
|
refass = mono_try_assembly_resolve (domain, assRef, NULL, refOnly, &error);
|
||||||
|
- if (!is_ok (&error))
|
||||||
|
- goto leave;
|
||||||
|
+ if (!mono_error_ok (&error)) {
|
||||||
|
+ mono_error_set_pending_exception (&error);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
return refass;
|
||||||
|
}
|
||||||
|
@@ -2066,31 +2047,25 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoString *assRef,
|
||||||
|
/* MS.NET doesn't seem to call the assembly resolve handler for refonly assemblies */
|
||||||
|
if (!refOnly) {
|
||||||
|
refass = mono_try_assembly_resolve (domain, assRef, NULL, refOnly, &error);
|
||||||
|
- if (!is_ok (&error))
|
||||||
|
- goto leave;
|
||||||
|
+ if (!mono_error_ok (&error)) {
|
||||||
|
+ mono_error_set_pending_exception (&error);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
refass = NULL;
|
||||||
|
- if (!refass)
|
||||||
|
- goto leave;
|
||||||
|
- ass = refass->assembly;
|
||||||
|
+ if (!refass) {
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!refOnly && prevent_running_reference_assembly (ass, &error))
|
||||||
|
- goto leave;
|
||||||
|
-
|
||||||
|
- g_assert (ass);
|
||||||
|
- if (refass == NULL) {
|
||||||
|
+ if (refass == NULL)
|
||||||
|
refass = mono_assembly_get_object_checked (domain, ass, &error);
|
||||||
|
- if (!is_ok (&error))
|
||||||
|
- goto leave;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- MONO_OBJECT_SETREF (refass, evidence, evidence);
|
||||||
|
|
||||||
|
-leave:
|
||||||
|
- g_free (name);
|
||||||
|
- mono_error_set_pending_exception (&error);
|
||||||
|
+ if (refass == NULL)
|
||||||
|
+ mono_error_set_pending_exception (&error);
|
||||||
|
+ else
|
||||||
|
+ MONO_OBJECT_SETREF (refass, evidence, evidence);
|
||||||
|
return refass;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c
|
||||||
|
index 7bd02ff..c1e88da 100644
|
||||||
|
--- a/mono/metadata/assembly.c
|
||||||
|
+++ b/mono/metadata/assembly.c
|
||||||
|
@@ -1176,23 +1176,6 @@ mono_assembly_load_reference (MonoImage *image, int index)
|
||||||
|
aname.major, aname.minor, aname.build, aname.revision,
|
||||||
|
strlen ((char*)aname.public_key_token) == 0 ? "(none)" : (char*)aname.public_key_token, extra_msg);
|
||||||
|
g_free (extra_msg);
|
||||||
|
-
|
||||||
|
- } else if (!image->assembly->ref_only) {
|
||||||
|
- MonoError error;
|
||||||
|
- if (mono_assembly_get_reference_assembly_attribute (reference, &error)) {
|
||||||
|
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY, "The following reference assembly assembly referenced from %s was not loaded. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context:\n"
|
||||||
|
- " Assembly: %s (assemblyref_index=%d)\n"
|
||||||
|
- " Version: %d.%d.%d.%d\n"
|
||||||
|
- " Public Key: %s\n",
|
||||||
|
- image->name, aname.name, index,
|
||||||
|
- aname.major, aname.minor, aname.build, aname.revision,
|
||||||
|
- strlen ((char*)aname.public_key_token) == 0 ? "(none)" : (char*)aname.public_key_token);
|
||||||
|
- reference = NULL; /* don't load reference assemblies for execution */
|
||||||
|
- }
|
||||||
|
- if (!is_ok (&error)) {
|
||||||
|
- reference = NULL;
|
||||||
|
- mono_error_cleanup (&error);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
mono_assemblies_lock ();
|
||||||
|
diff --git a/mono/metadata/class.c b/mono/metadata/class.c
|
||||||
|
index 56e12ad..17da478 100644
|
||||||
|
--- a/mono/metadata/class.c
|
||||||
|
+++ b/mono/metadata/class.c
|
||||||
|
@@ -5544,7 +5544,6 @@ mono_class_setup_parent (MonoClass *klass, MonoClass *parent)
|
||||||
|
/* set the parent to something useful and safe, but mark the type as broken */
|
||||||
|
parent = mono_defaults.object_class;
|
||||||
|
mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
|
||||||
|
- g_assert (parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
klass->parent = parent;
|
||||||
|
diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c
|
||||||
|
index 93aced6..a3ba4a7 100644
|
||||||
|
--- a/mono/metadata/domain.c
|
||||||
|
+++ b/mono/metadata/domain.c
|
||||||
|
@@ -807,16 +807,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
|
||||||
|
|
||||||
|
mono_profiler_appdomain_name (domain, domain->friendly_name);
|
||||||
|
|
||||||
|
- /* Have to do this quite late so that we at least have System.Object */
|
||||||
|
- MonoError custom_attr_error;
|
||||||
|
- if (mono_assembly_get_reference_assembly_attribute (ass, &custom_attr_error)) {
|
||||||
|
- char *corlib_file = g_build_filename (mono_assembly_getrootdir (), "mono", current_runtime->framework_version, "mscorlib.dll", NULL);
|
||||||
|
- g_print ("Could not load file or assembly %s. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context.", corlib_file);
|
||||||
|
- g_free (corlib_file);
|
||||||
|
- exit (1);
|
||||||
|
- }
|
||||||
|
- mono_error_assert_ok (&custom_attr_error);
|
||||||
|
-
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
1
debian/patches/series
vendored
Normal file
1
debian/patches/series
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
fix_gacutil.patch
|
Loading…
x
Reference in New Issue
Block a user