Commit 2930542f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

GfxPatchMeshShading::parse: Fix abort on broken files

parent b7d1374c
...@@ -5260,8 +5260,12 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di ...@@ -5260,8 +5260,12 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di
if (nPatchesA == patchesSize) { if (nPatchesA == patchesSize) {
int oldPatchesSize = patchesSize; int oldPatchesSize = patchesSize;
patchesSize = (patchesSize == 0) ? 16 : 2 * patchesSize; patchesSize = (patchesSize == 0) ? 16 : 2 * patchesSize;
patchesA = (GfxPatch *)greallocn(patchesA, patchesA = (GfxPatch *)greallocn_checkoverflow(patchesA,
patchesSize, sizeof(GfxPatch)); patchesSize, sizeof(GfxPatch));
if (unlikely(!patchesA)) {
for (int k = 0; k < nFuncsA; ++k) delete funcsA[k];
return nullptr;
}
memset(patchesA + oldPatchesSize, 0, (patchesSize - oldPatchesSize) * sizeof(GfxPatch)); memset(patchesA + oldPatchesSize, 0, (patchesSize - oldPatchesSize) * sizeof(GfxPatch));
} }
p = &patchesA[nPatchesA]; p = &patchesA[nPatchesA];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment