diff options
| -rw-r--r-- | examples/gpu-printing/gpu-printing.cpp | 10 | ||||
| -rw-r--r-- | tools/slang-unit-test/unit-test-compile-benchmark.cpp | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/examples/gpu-printing/gpu-printing.cpp b/examples/gpu-printing/gpu-printing.cpp index f71578554..a0d5e5919 100644 --- a/examples/gpu-printing/gpu-printing.cpp +++ b/examples/gpu-printing/gpu-printing.cpp @@ -140,8 +140,16 @@ void GPUPrinting::processGPUPrintCommands(const void* data, size_t dataSize) // avoid crashes from a command trying to fetch data past // the end of the buffer. // - if (payloadWordCount > size_t(dataCursor - dataEnd)) + ptrdiff_t wordsAvailable = dataEnd - dataCursor; + if (wordsAvailable < 0 || payloadWordCount > (uint32_t)wordsAvailable) { + fprintf( + stderr, + "error: GPU printing buffer corruption or insufficient data for payload.\n" + " Op: %d, Declared Payload Words: %u, Available Words: %td\n", + (int)op, + payloadWordCount, + (wordsAvailable < 0 ? 0 : wordsAvailable)); break; } // diff --git a/tools/slang-unit-test/unit-test-compile-benchmark.cpp b/tools/slang-unit-test/unit-test-compile-benchmark.cpp index e38edc6ad..1c0b86156 100644 --- a/tools/slang-unit-test/unit-test-compile-benchmark.cpp +++ b/tools/slang-unit-test/unit-test-compile-benchmark.cpp @@ -88,11 +88,12 @@ void main(uint3 threadIdx : SV_DispatchThreadID) SLANG_CHECK(module != nullptr); ComPtr<slang::IEntryPoint> entryPoint; - module->findAndCheckEntryPoint( + SlangResult res = module->findAndCheckEntryPoint( "main", - SLANG_STAGE_VERTEX, + SLANG_STAGE_COMPUTE, entryPoint.writeRef(), diagnosticBlob.writeRef()); + SLANG_CHECK(res == SLANG_OK); slang::IComponentType* componentTypes[2] = {module, entryPoint.get()}; ComPtr<slang::IComponentType> composedProgram; |
