Revert the previous SVACE fix for VMA null termination issue 41/322041/3
authorRichard Huang <r.huang@samsung.com>
Wed, 2 Apr 2025 10:44:23 +0000 (11:44 +0100)
committerRichard Huang <r.huang@samsung.com>
Wed, 2 Apr 2025 12:39:17 +0000 (12:39 +0000)
The previous fix is try to fix the SVACE error to ensure null
termination in VmaStringBuilder::Add by resizing the buffer
and appending '\0' after copying. It's noticed that VMA
statistics string is broken after this fix.

We realised that such fix is wrong, because the data is only
used as an input to the function VmaCreateStringCopy, which
takes explicit length and adds null terminator to the created
copy.

We should ignore this SVACE error, as advised by the author
of VMA:
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/pull/463

Change-Id: I5027a4ebe07a102c05a07108cc0108bcf1d73fc1

third-party/vma/vk_mem_alloc.h

index 2c1c7f75543d992c95407bd24b8a7a5a451d740f..c5edfbcebf37d7c858741ab1e3c9d29d68cb371c 100644 (file)
@@ -5647,14 +5647,13 @@ private:
 #ifndef _VMA_STRING_BUILDER_FUNCTIONS
 void VmaStringBuilder::Add(const char* pStr)
 {
-    if (pStr == nullptr)
-        return;
-
     const size_t strLen = strlen(pStr);
-    const size_t oldCount = m_Data.size();
-
-    m_Data.resize(oldCount + strLen + 1);
-    memcpy(m_Data.data() + oldCount, pStr, strLen + 1);
+    if (strLen > 0)
+    {
+        const size_t oldCount = m_Data.size();
+        m_Data.resize(oldCount + strLen);
+        memcpy(m_Data.data() + oldCount, pStr, strLen);
+    }
 }
 
 void VmaStringBuilder::AddNumber(uint32_t num)