From 90605a51d8197d87f9b280d99c9da5e1627f0977 Mon Sep 17 00:00:00 2001 From: Gabríel Arthúr Pétursson Date: Wed, 21 Mar 2018 22:44:11 +0000 Subject: layers: Avoid reading pointer to array when count is zero Take for example VkSubmitInfo. It has, amongst others, two fields: waitSemaphoreCount and pWaitSemaphores. The specification states that if waitSemaphoreCount is zero, the application may leave pWaitSemaphores uninitialized (in essence, that field is ignored). The layers read that value anyway, triggering uninitialized read errors by memory sanitization tools. Fixes uninitialized read in QueueSubmitSemaphoresAndLayoutTracking. --- scripts/object_tracker_generator.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'scripts/object_tracker_generator.py') diff --git a/scripts/object_tracker_generator.py b/scripts/object_tracker_generator.py index 00b9bcd6..5130e0f4 100644 --- a/scripts/object_tracker_generator.py +++ b/scripts/object_tracker_generator.py @@ -744,15 +744,11 @@ class ObjectTrackerOutputGenerator(OutputGenerator): commonparent_vuid_string = 'VUID-%s-commonparent' % parent_name parent_vuid = self.GetVuid(commonparent_vuid_string) if obj_count is not None: - pre_call_code += '%s if (%s%s) {\n' % (indent, prefix, obj_name) - indent = self.incIndent(indent) pre_call_code += '%s for (uint32_t %s = 0; %s < %s; ++%s) {\n' % (indent, index, index, obj_count, index) indent = self.incIndent(indent) pre_call_code += '%s skip |= ValidateObject(%s, %s%s[%s], %s, %s, %s, %s);\n' % (indent, disp_name, prefix, obj_name, index, self.GetVulkanObjType(obj_type), null_allowed, param_vuid, parent_vuid) indent = self.decIndent(indent) pre_call_code += '%s }\n' % indent - indent = self.decIndent(indent) - pre_call_code += '%s }\n' % indent else: pre_call_code += '%s skip |= ValidateObject(%s, %s%s, %s, %s, %s, %s);\n' % (indent, disp_name, prefix, obj_name, self.GetVulkanObjType(obj_type), null_allowed, param_vuid, parent_vuid) return decl_code, pre_call_code, post_call_code -- cgit v1.2.3