Do not access temporary C++ object members by reference
authorSlawomir Cygan <slawomir.cygan@intel.com>
Thu, 22 Feb 2018 17:55:01 +0000 (18:55 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 1 Mar 2018 12:20:22 +0000 (07:20 -0500)
Fix undefined C++ behavior (resulting in errors when doing runtime memory checks),
where a temporary object returned by getInputAspects() method is used by a reference
to a member after the temporary is destructed.

It seems getInputAspects should just return reference.

Affects: dEQP-VK.renderpass.*.input*

Component: Vulkan

VK-GL-CTS Issue: 1033

Change-Id: I71edabed71ea63f46cdbc45c966d57cd020565ab

external/vulkancts/modules/vulkan/renderpass/vktRenderPassTests.cpp

index 68faea6..d00cf5f 100644 (file)
@@ -677,7 +677,7 @@ public:
        const vector<Attachment>&                                                       getAttachments  (void) const { return m_attachments;    }
        const vector<Subpass>&                                                          getSubpasses    (void) const { return m_subpasses;              }
        const vector<SubpassDependency>&                                        getDependencies (void) const { return m_dependencies;   }
-       const vector<VkInputAttachmentAspectReferenceKHR>       getInputAspects (void) const { return m_inputAspects;   }
+       const vector<VkInputAttachmentAspectReferenceKHR>&      getInputAspects (void) const { return m_inputAspects;   }
 
 private:
        const vector<Attachment>                                                        m_attachments;