From 3ded6e590a96dac3baaf405519f51025f2dcc858 Mon Sep 17 00:00:00 2001 From: Baldur Karlsson Date: Thu, 15 Mar 2018 13:01:22 +0000 Subject: [PATCH] Fix crash in DXBCFile processing if array is last binding. Closes #919 --- renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp b/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp index 5da8b8111..8a9a72da1 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_inspect.cpp @@ -699,6 +699,10 @@ DXBCFile::DXBCFile(const void *ByteCode, size_t ByteCodeLength) // remove the array item, and get the iterator to the next item to process it = resArray.erase(it); + // if we're now pointing at the end of the vector, save that, as the iterator will be + // invalid after we push back below. + bool last = (it == resArray.end()); + string rname = desc.name; uint32_t arraySize = desc.bindCount; @@ -711,6 +715,10 @@ DXBCFile::DXBCFile(const void *ByteCode, size_t ByteCodeLength) desc.reg++; } + // if we just expanded the last item, break out of the loop + if(last) + break; + continue; }