Browse Source

Fix external validator crash on empty struct (#2323)

Fixes #2322
Helena Kotas 6 years ago
parent
commit
e3cf6b6ed9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/HLSL/DxilValidation.cpp

+ 1 - 1
lib/HLSL/DxilValidation.cpp

@@ -3772,7 +3772,7 @@ CollectCBufferRanges(DxilStructAnnotation *annotation,
           CollectCBufferRanges(EltAnnotation, constAllocator,
                                structBase, typeSys, cbName, ValCtx);
         } else {
-          if (nullptr != constAllocator.Insert(
+          if (EltSize > 0 && nullptr != constAllocator.Insert(
                 &fieldAnnotation, structBase, structBase + EltSize - 1)) {
             ValCtx.EmitFormatError(
                 ValidationRule::SmCBufferOffsetOverlap,