libqt5-qt3d/0001-assimp-Fix-out-of-bound-access.patch

25 lines
1.0 KiB
Diff

From 614911bb3b1bfc3a1799ae2b3cca306270f3fb97 Mon Sep 17 00:00:00 2001
From: Kim Kulling <kim.kulling@googlemail.com>
Date: Wed, 3 Jul 2024 21:05:53 +0200
Subject: [PATCH] Fix out of bound access
---
code/AssetLib/Ply/PlyLoader.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp b/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp
index 3e92339fb4..0c2463f240 100644
--- a/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp
+++ b/src/3rdparty/assimp/src/code/Ply/PlyLoader.cpp
@@ -577,6 +577,10 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst
if (mGeneratedMesh->mFaces == nullptr) {
mGeneratedMesh->mNumFaces = pcElement->NumOccur;
mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces];
+ } else {
+ if (mGeneratedMesh->mNumFaces < pcElement->NumOccur) {
+ throw DeadlyImportError("Invalid .ply file: Too many faces");
+ }
}
if (!bIsTriStrip) {