fix lua not load type in a safe manner - #1144
Conversation
|
The mod in the zip is:
using System;
namespace Celeste.Mod.quirk;
public class quirkModule : EverestModule
{
[MonoMod.Game]
class YetAnother;
public override void Load()
{
}
public override void Unload()
{
}
}
using Mono.Cecil;
using System;
namespace MonoMod
{
[MonoModCustomAttribute(nameof(MonoModRules.Start))]
public class GameAttribute : Attribute;
public class MonoModRules
{
public static void Start(TypeDefinition type, CustomAttribute __)
{
var m = type.Module;
var scope = new AssemblyNameReference("can you get it", new(1, 0, 0, 0));
var btype = m.ImportReference(new TypeReference("who cares", "missing name", null, scope));
type.BaseType = btype;
}
}
}When attempting to load the mod without the changes, when Everest starts, it crashes with the following exception: It also logs the following line: The exception does not show up when applying the changes, only leaving the warning. If I understand correctly what is happening, the issue is that the non-public class Did this behavior cause issue with existing or upcoming mods? |
|
the only real-world program may be ILHookDebugger 0.99.9, if it's real-world program i think it's because GetNestedTypes is trying to load a type that can't be loaded |
| // Non-public type instances can still be passed / returned. | ||
| /* | ||
| if (!type.IsPublic) | ||
| continue; | ||
| */ |
There was a problem hiding this comment.
issue?: isn't this the same for nonpublic nested types? but on line 178 you have if (!type.IsNestedPublic) return null;
There was a problem hiding this comment.
There was a problem hiding this comment.
hm, i see
so i guess you're at least not introducing a new problem lol
realistically i don't think this is a big deal since nested private types aren't used that much and it should be easy to change later if it turns out to be an issue ^_^
|
The pull request was approved and entered the 3-day last-call window. Since no PR should be merged within 3 days of the next rolling release, the last-call window is extended further. |
i got a zip that works
quirk.zip (compile it yourself)