From e14a3cd6f18b80e04f4a045987111e0c751355fe Mon Sep 17 00:00:00 2001 From: Hendrik Eckardt Date: Tue, 17 Jun 2025 16:59:34 +0200 Subject: [PATCH] InstructionEmulator: Fix rare exception caused by null values in arrays --- de4dot.blocks/cflow/InstructionEmulator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/de4dot.blocks/cflow/InstructionEmulator.cs b/de4dot.blocks/cflow/InstructionEmulator.cs index 7a6251fe..4a066fd6 100644 --- a/de4dot.blocks/cflow/InstructionEmulator.cs +++ b/de4dot.blocks/cflow/InstructionEmulator.cs @@ -535,7 +535,10 @@ void Emulate_Newarr(Instruction instr) if (val.IsInt32()) { Int32Value arrSize = (Int32Value)val; - List arr = new List(new Value[arrSize.Value]); + List arr = new List(arrSize.Value); + for (int i = 0; i < arrSize.Value; i++) { + arr.Add(new UnknownValue()); + } valueStack.Push(new ObjectValue(arr)); } else