mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
update assimp to 6.0.5
This commit is contained in:
parent
2d2eb57e2e
commit
f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -47,12 +47,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
// Limit input size to 1MB to prevent OOMs and timeouts
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
|
||||
aiAttachLogStream(&stream);
|
||||
#endif
|
||||
|
||||
Importer importer;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize,
|
||||
aiProcessPreset_TargetRealtime_Quality, nullptr );
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, nullptr);
|
||||
|
||||
if (sc == nullptr) {
|
||||
return 0;
|
||||
|
|
@ -60,8 +67,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
|||
|
||||
Exporter exporter;
|
||||
exporter.ExportToBlob(sc, "fbx");
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
aiDetachLogStream(&stream);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
40
Engine/lib/assimp/fuzz/assimp_fuzzer.dict
Normal file
40
Engine/lib/assimp/fuzz/assimp_fuzzer.dict
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# OBJ
|
||||
"v "
|
||||
"vn "
|
||||
"vt "
|
||||
"f "
|
||||
"mtllib "
|
||||
"usemtl "
|
||||
|
||||
# GLTF (JSON)
|
||||
"asset"
|
||||
"scene"
|
||||
"scenes"
|
||||
"nodes"
|
||||
"meshes"
|
||||
"accessors"
|
||||
"bufferViews"
|
||||
"buffers"
|
||||
|
||||
# PLY
|
||||
"ply"
|
||||
"format"
|
||||
"element"
|
||||
"property"
|
||||
"vertex"
|
||||
"face"
|
||||
|
||||
# STL
|
||||
"solid"
|
||||
"facet"
|
||||
"normal"
|
||||
"outer loop"
|
||||
"vertex"
|
||||
"endloop"
|
||||
"endfacet"
|
||||
"endsolid"
|
||||
|
||||
# Collada (XML)
|
||||
"COLLADA"
|
||||
"library_geometries"
|
||||
"library_visual_scenes"
|
||||
63
Engine/lib/assimp/fuzz/assimp_fuzzer_collada.cc
Normal file
63
Engine/lib/assimp/fuzz/assimp_fuzzer_collada.cc
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "fuzzer_common.h"
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Importer importer;
|
||||
// Force Collada format (dae)
|
||||
if (!AssimpFuzz::ForceFormat(importer, "dae")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, "dae");
|
||||
|
||||
return 0;
|
||||
}
|
||||
63
Engine/lib/assimp/fuzz/assimp_fuzzer_fbx.cc
Normal file
63
Engine/lib/assimp/fuzz/assimp_fuzzer_fbx.cc
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "fuzzer_common.h"
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Importer importer;
|
||||
// Force FBX format
|
||||
if (!AssimpFuzz::ForceFormat(importer, "fbx")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, "fbx");
|
||||
|
||||
return 0;
|
||||
}
|
||||
63
Engine/lib/assimp/fuzz/assimp_fuzzer_glb.cc
Normal file
63
Engine/lib/assimp/fuzz/assimp_fuzzer_glb.cc
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "fuzzer_common.h"
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Importer importer;
|
||||
// Force GLB binary format only (see assimp_fuzzer_gltf.cc for text glTF)
|
||||
if (!AssimpFuzz::ForceFormat(importer, "glb")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, "glb");
|
||||
|
||||
return 0;
|
||||
}
|
||||
63
Engine/lib/assimp/fuzz/assimp_fuzzer_gltf.cc
Normal file
63
Engine/lib/assimp/fuzz/assimp_fuzzer_gltf.cc
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "fuzzer_common.h"
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Importer importer;
|
||||
// Force glTF text format only (see assimp_fuzzer_glb.cc for binary GLB)
|
||||
if (!AssimpFuzz::ForceFormat(importer, "gltf")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, "gltf");
|
||||
|
||||
return 0;
|
||||
}
|
||||
65
Engine/lib/assimp/fuzz/assimp_fuzzer_obj.cc
Normal file
65
Engine/lib/assimp/fuzz/assimp_fuzzer_obj.cc
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "fuzzer_common.h"
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
// Limit input size to 1MB
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Importer importer;
|
||||
// Force OBJ format
|
||||
if (!AssimpFuzz::ForceFormat(importer, "obj")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
// We pass "obj" hint as well, though only OBJ loader is registered now.
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, "obj");
|
||||
|
||||
return 0;
|
||||
}
|
||||
63
Engine/lib/assimp/fuzz/assimp_fuzzer_stl.cc
Normal file
63
Engine/lib/assimp/fuzz/assimp_fuzzer_stl.cc
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "fuzzer_common.h"
|
||||
#include <assimp/cimport.h>
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
|
||||
if (dataSize > 1024 * 1024) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Importer importer;
|
||||
// Force STL format
|
||||
if (!AssimpFuzz::ForceFormat(importer, "stl")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int flags = aiProcessPreset_TargetRealtime_Quality | aiProcess_ValidateDataStructure;
|
||||
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize, flags, "stl");
|
||||
|
||||
return 0;
|
||||
}
|
||||
107
Engine/lib/assimp/fuzz/fuzzer_common.h
Normal file
107
Engine/lib/assimp/fuzz/fuzzer_common.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2026, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/BaseImporter.h>
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
namespace AssimpFuzz {
|
||||
|
||||
// Unregisters all loaders except the ones matching the given extension.
|
||||
// Returns true if at least one loader was kept.
|
||||
inline bool ForceFormat(Assimp::Importer& importer, const char* targetExtension) {
|
||||
size_t count = importer.GetImporterCount();
|
||||
std::vector<Assimp::BaseImporter*> toRemove;
|
||||
bool found = false;
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
const aiImporterDesc* desc = importer.GetImporterInfo(i);
|
||||
Assimp::BaseImporter* imp = importer.GetImporter(i);
|
||||
|
||||
if (!desc || !imp) continue;
|
||||
|
||||
// Check if the importer supports the target extension
|
||||
// mFileExtensions is a space-separated list (e.g., "obj mod")
|
||||
// We wrap target in spaces or check bounds to be precise,
|
||||
// but for fuzzing, a simple strstr is usually sufficient
|
||||
// if the target string is unique enough (e.g. "gltf", "obj").
|
||||
// A more robust check:
|
||||
|
||||
bool isTarget = false;
|
||||
const char* extList = desc->mFileExtensions;
|
||||
if (!extList) {
|
||||
toRemove.push_back(imp);
|
||||
continue;
|
||||
}
|
||||
const size_t targetLen = strlen(targetExtension);
|
||||
|
||||
const char* p = extList;
|
||||
while ((p = strstr(p, targetExtension)) != nullptr) {
|
||||
// Check boundaries
|
||||
const char prev = (p == extList) ? ' ' : *(p - 1);
|
||||
const char next = *(p + targetLen);
|
||||
|
||||
if (prev == ' ' && (next == ' ' || next == '\0')) {
|
||||
isTarget = true;
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
if (isTarget) {
|
||||
found = true;
|
||||
} else {
|
||||
toRemove.push_back(imp);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto* imp : toRemove) {
|
||||
importer.UnregisterLoader(imp);
|
||||
delete imp; // Free the unregistered importer to prevent memory leaks
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
}
|
||||
22
Engine/lib/assimp/fuzz/ossfuzz/Dockerfile
Normal file
22
Engine/lib/assimp/fuzz/ossfuzz/Dockerfile
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Copyright 2021 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
RUN apt-get update && apt-get install -y make autoconf automake libtool ninja-build cmake zip
|
||||
|
||||
RUN git clone --depth 1 https://github.com/assimp/assimp.git assimp
|
||||
WORKDIR assimp
|
||||
COPY build.sh $SRC/
|
||||
100
Engine/lib/assimp/fuzz/ossfuzz/build.sh
Normal file
100
Engine/lib/assimp/fuzz/ossfuzz/build.sh
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
# Build directory
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
# Configure
|
||||
cmake .. \
|
||||
-G Ninja \
|
||||
-DCMAKE_C_COMPILER="${CC}" \
|
||||
-DCMAKE_CXX_COMPILER="${CXX}" \
|
||||
-DCMAKE_C_FLAGS="${CFLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
|
||||
-DASSIMP_BUILD_ZLIB=ON \
|
||||
-DASSIMP_BUILD_TESTS=OFF \
|
||||
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=ON \
|
||||
-DASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT=ON
|
||||
|
||||
# Build the library
|
||||
ninja
|
||||
|
||||
# Helper function to build fuzzers
|
||||
build_fuzzer() {
|
||||
local fuzzer_name=$1
|
||||
local source_file=$2
|
||||
|
||||
echo "Building $fuzzer_name..."
|
||||
$CXX $CXXFLAGS -I../include -I../build/include -c "$source_file" -o "${fuzzer_name}.o"
|
||||
|
||||
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE "${fuzzer_name}.o" -o "$OUT/${fuzzer_name}" \
|
||||
./lib/libassimp.a \
|
||||
./contrib/zlib/libzlibstatic.a \
|
||||
-lpthread -ldl
|
||||
}
|
||||
|
||||
# 1. Generic Fuzzer
|
||||
build_fuzzer "assimp_fuzzer" "../fuzz/assimp_fuzzer.cc"
|
||||
# Corpus for generic fuzzer (all models)
|
||||
(cd ../test/models && zip -q -r $OUT/assimp_fuzzer_seed_corpus.zip .)
|
||||
# Dictionary
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer.dict || true
|
||||
|
||||
|
||||
# 2. OBJ Fuzzer
|
||||
build_fuzzer "assimp_fuzzer_obj" "../fuzz/assimp_fuzzer_obj.cc"
|
||||
if [ -d "../test/models/OBJ" ]; then
|
||||
(cd ../test/models/OBJ && zip -q -r $OUT/assimp_fuzzer_obj_seed_corpus.zip .)
|
||||
fi
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer_obj.dict || true
|
||||
|
||||
|
||||
# 3. GLTF Fuzzer (text format only, glTF and glTF2 versions)
|
||||
build_fuzzer "assimp_fuzzer_gltf" "../fuzz/assimp_fuzzer_gltf.cc"
|
||||
mkdir -p gltf_corpus
|
||||
[ -d "../test/models/glTF" ] && cp -r ../test/models/glTF/* gltf_corpus/
|
||||
[ -d "../test/models/glTF2" ] && cp -r ../test/models/glTF2/* gltf_corpus/
|
||||
if [ -d "gltf_corpus" ] && [ "$(ls -A gltf_corpus)" ]; then
|
||||
(cd gltf_corpus && zip -q -r $OUT/assimp_fuzzer_gltf_seed_corpus.zip .)
|
||||
fi
|
||||
rm -rf gltf_corpus
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer_gltf.dict || true
|
||||
|
||||
|
||||
# 4. GLB Fuzzer (binary glTF format)
|
||||
build_fuzzer "assimp_fuzzer_glb" "../fuzz/assimp_fuzzer_glb.cc"
|
||||
mkdir -p glb_corpus
|
||||
# GLB files can be found in glTF and glTF2 directories
|
||||
[ -d "../test/models/glTF" ] && find ../test/models/glTF -name "*.glb" -exec cp {} glb_corpus/ \; 2>/dev/null || true
|
||||
[ -d "../test/models/glTF2" ] && find ../test/models/glTF2 -name "*.glb" -exec cp {} glb_corpus/ \; 2>/dev/null || true
|
||||
if [ -d "glb_corpus" ] && [ "$(ls -A glb_corpus)" ]; then
|
||||
(cd glb_corpus && zip -q -r $OUT/assimp_fuzzer_glb_seed_corpus.zip .)
|
||||
fi
|
||||
rm -rf glb_corpus
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer_glb.dict || true
|
||||
|
||||
|
||||
# 5. FBX Fuzzer
|
||||
build_fuzzer "assimp_fuzzer_fbx" "../fuzz/assimp_fuzzer_fbx.cc"
|
||||
if [ -d "../test/models/FBX" ]; then
|
||||
(cd ../test/models/FBX && zip -q -r $OUT/assimp_fuzzer_fbx_seed_corpus.zip .)
|
||||
fi
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer_fbx.dict || true
|
||||
|
||||
|
||||
# 6. Collada Fuzzer
|
||||
build_fuzzer "assimp_fuzzer_collada" "../fuzz/assimp_fuzzer_collada.cc"
|
||||
if [ -d "../test/models/Collada" ]; then
|
||||
(cd ../test/models/Collada && zip -q -r $OUT/assimp_fuzzer_collada_seed_corpus.zip .)
|
||||
fi
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer_collada.dict || true
|
||||
|
||||
|
||||
# 7. STL Fuzzer
|
||||
build_fuzzer "assimp_fuzzer_stl" "../fuzz/assimp_fuzzer_stl.cc"
|
||||
if [ -d "../test/models/STL" ]; then
|
||||
(cd ../test/models/STL && zip -q -r $OUT/assimp_fuzzer_stl_seed_corpus.zip .)
|
||||
fi
|
||||
cp ../fuzz/assimp_fuzzer.dict $OUT/assimp_fuzzer_stl.dict || true
|
||||
14
Engine/lib/assimp/fuzz/ossfuzz/project.yaml
Normal file
14
Engine/lib/assimp/fuzz/ossfuzz/project.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
homepage: "https://github.com/assimp/assimp"
|
||||
main_repo: "https://github.com/assimp/assimp"
|
||||
language: c++
|
||||
primary_contact: "kim.kulling@assimp.org"
|
||||
auto_ccs:
|
||||
- "kim.kulling@googlemail.com"
|
||||
sanitizers:
|
||||
- address
|
||||
- undefined
|
||||
- memory
|
||||
fuzzing_engines:
|
||||
- libfuzzer
|
||||
- afl
|
||||
- honggfuzz
|
||||
Loading…
Add table
Add a link
Reference in a new issue