From c3a132086e32ddd237a8fa6cca79941c678d5857 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Tue, 8 Jan 2019 15:19:42 -0800 Subject: [PATCH] check for valid IL offsets before computing block ILsize --- src/jit/flowgraph.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index 2df3cce..eedb1aa 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -6835,8 +6835,14 @@ void Compiler::fgImport() // Assume if we generate any IR for the block we generate IR for the entire block. if (!block->isEmpty()) { - unsigned blockILSize = blockILSize = block->bbCodeOffsEnd - block->bbCodeOffs; - importedILSize += blockILSize; + IL_OFFSET beginOffset = block->bbCodeOffs; + IL_OFFSET endOffset = block->bbCodeOffsEnd; + + if ((beginOffset != BAD_IL_OFFSET) && (endOffset != BAD_IL_OFFSET) && (endOffset > beginOffset)) + { + unsigned blockILSize = endOffset - beginOffset; + importedILSize += blockILSize; + } } } } -- 2.7.4