From fadd5eb953deb4eed64d3fc84965acda05d2c0e1 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 21 Feb 2024 10:50:14 -0800 Subject: [PATCH] fix a uninitialized memory access when no renderable are visible --- filament/src/RenderPass.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filament/src/RenderPass.cpp b/filament/src/RenderPass.cpp index b585c4d328..d5063043f5 100644 --- a/filament/src/RenderPass.cpp +++ b/filament/src/RenderPass.cpp @@ -164,6 +164,11 @@ void RenderPass::appendCommands(FEngine& engine, // trace the number of visible renderables SYSTRACE_VALUE32("visibleRenderables", vr.size()); if (UTILS_UNLIKELY(vr.empty())) { + // no renderables, we still need the sentinel and the command buffer size should be + // exactly 1. + assert_invariant(commands.size() == 1); + Command* curr = commands.data(); + curr->key = uint64_t(Pass::SENTINEL); return; }