diff options
author | Andy Ayers <andya@microsoft.com> | 2019-01-08 15:19:42 -0800 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2019-01-08 15:19:42 -0800 |
commit | c3a132086e32ddd237a8fa6cca79941c678d5857 (patch) | |
tree | 1e67a8155cf7d8c2e30b64bd0ba9958aecc94322 /src/jit/flowgraph.cpp | |
parent | 3f182cfcf80af6500217673d920c52ccf6919661 (diff) | |
download | coreclr-c3a132086e32ddd237a8fa6cca79941c678d5857.tar.gz coreclr-c3a132086e32ddd237a8fa6cca79941c678d5857.tar.bz2 coreclr-c3a132086e32ddd237a8fa6cca79941c678d5857.zip |
check for valid IL offsets before computing block ILsize
Diffstat (limited to 'src/jit/flowgraph.cpp')
-rw-r--r-- | src/jit/flowgraph.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index 2df3cce3ba..eedb1aa58f 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; + } } } } |