浏览代码

prevent zero sized array allocations

CwTCwT 7 年之前
父节点
当前提交
7db668e66f
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      code/BlenderCustomData.cpp

+ 1 - 1
code/BlenderCustomData.cpp

@@ -155,7 +155,7 @@ namespace Assimp {
             }
 
             const CustomDataTypeDescription cdtd = customDataTypeDescriptions[cdtype];
-            if (cdtd.Read && cdtd.Create && cdtd.Destroy) {
+            if (cdtd.Read && cdtd.Create && cdtd.Destroy && cnt > 0) {
                 // allocate cnt elements and parse them from file
                 out.reset(cdtd.Create(cnt), cdtd.Destroy);
                 return cdtd.Read(out.get(), cnt, db);