Compare commits
2 Commits
master
...
refactor_g
Author | SHA1 | Date |
---|---|---|
Kim Kulling | 243c1e15fe | |
kimkulling | 6cca078947 |
|
@ -51,66 +51,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF1_IMPORTER)
|
||||||
|
|
||||||
#include <assimp/Exceptional.h>
|
#include "AssetLib/glTFCommon/glTFCommon.h"
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#include <vector>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
#ifndef RAPIDJSON_HAS_STDSTRING
|
|
||||||
#define RAPIDJSON_HAS_STDSTRING 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
|
|
||||||
#define RAPIDJSON_NOMEMBERITERATORCLASS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <rapidjson/rapidjson.h>
|
|
||||||
#include <rapidjson/document.h>
|
|
||||||
#include <rapidjson/error/en.h>
|
|
||||||
|
|
||||||
#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ASSIMP_API
|
|
||||||
# include <memory>
|
|
||||||
# include <assimp/DefaultIOSystem.h>
|
|
||||||
# include <assimp/ByteSwapper.h>
|
|
||||||
#else
|
|
||||||
# include <memory>
|
|
||||||
# define AI_SWAP4(p)
|
|
||||||
# define ai_assert
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if _MSC_VER > 1500 || (defined __GNUC___)
|
namespace glTF {
|
||||||
# define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
|
|
||||||
# else
|
|
||||||
# define gltf_unordered_map map
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
|
|
||||||
# include <unordered_map>
|
|
||||||
# if _MSC_VER > 1600
|
|
||||||
# define gltf_unordered_map unordered_map
|
|
||||||
# else
|
|
||||||
# define gltf_unordered_map tr1::unordered_map
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "AssetLib/glTF/glTFCommon.h"
|
|
||||||
|
|
||||||
namespace glTF
|
|
||||||
{
|
|
||||||
using glTFCommon::shared_ptr;
|
using glTFCommon::shared_ptr;
|
||||||
using glTFCommon::IOSystem;
|
using glTFCommon::IOSystem;
|
||||||
using glTFCommon::IOStream;
|
using glTFCommon::IOStream;
|
||||||
|
|
|
@ -62,37 +62,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifndef RAPIDJSON_HAS_STDSTRING
|
|
||||||
#define RAPIDJSON_HAS_STDSTRING 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
|
|
||||||
#define RAPIDJSON_NOMEMBERITERATORCLASS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <rapidjson/document.h>
|
|
||||||
#include <rapidjson/error/en.h>
|
|
||||||
#include <rapidjson/rapidjson.h>
|
|
||||||
|
|
||||||
#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ASSIMP_API
|
|
||||||
#include <assimp/ByteSwapper.h>
|
|
||||||
#include <assimp/DefaultIOSystem.h>
|
|
||||||
#include <memory>
|
|
||||||
#else
|
|
||||||
#include <memory>
|
|
||||||
#define AI_SWAP4(p)
|
|
||||||
#define ai_assert
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _MSC_VER > 1500 || (defined __GNUC___)
|
#if _MSC_VER > 1500 || (defined __GNUC___)
|
||||||
#define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
|
#define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
|
||||||
#else
|
#else
|
||||||
|
@ -112,9 +81,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assimp/StringUtils.h>
|
#include "AssetLib/glTFCommon/glTFCommon.h"
|
||||||
|
|
||||||
#include "AssetLib/glTF/glTFCommon.h"
|
|
||||||
|
|
||||||
namespace glTF2 {
|
namespace glTF2 {
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AssetLib/glTF/glTFCommon.h"
|
#include "AssetLib/glTFCommon/glTFCommon.h"
|
||||||
|
|
||||||
#include <assimp/StringUtils.h>
|
#include <assimp/StringUtils.h>
|
||||||
#include <assimp/DefaultLogger.hpp>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
|
|
|
@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include "AssetLib/glTF/glTFCommon.h"
|
#include "AssetLib/glTFCommon/glTFCommon.h"
|
||||||
|
|
||||||
namespace glTFCommon {
|
namespace glTFCommon {
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_GLTF_IMPORTER
|
||||||
|
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Exceptional.h>
|
||||||
|
#include <assimp/StringUtils.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -51,13 +52,25 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
|
||||||
|
# pragma GCC diagnostic push
|
||||||
|
# pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define RAPIDJSON_HAS_STDSTRING 1
|
#define RAPIDJSON_HAS_STDSTRING 1
|
||||||
#define RAPIDJSON_NOMEMBERITERATORCLASS
|
#define RAPIDJSON_NOMEMBERITERATORCLASS
|
||||||
|
|
||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
#include <rapidjson/error/en.h>
|
#include <rapidjson/error/en.h>
|
||||||
#include <rapidjson/rapidjson.h>
|
#include <rapidjson/rapidjson.h>
|
||||||
|
|
||||||
|
#if (__GNUC__ == 8 && __GNUC_MINOR__ >= 0)
|
||||||
|
# pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ASSIMP_API
|
#ifdef ASSIMP_API
|
||||||
# include <assimp/ByteSwapper.h>
|
# include <assimp/ByteSwapper.h>
|
||||||
# include <assimp/DefaultIOSystem.h>
|
# include <assimp/DefaultIOSystem.h>
|
||||||
|
@ -80,6 +93,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
# define gltf_unordered_map unordered_map
|
# define gltf_unordered_map unordered_map
|
||||||
# else
|
# else
|
||||||
# define gltf_unordered_map tr1::unordered_map
|
# define gltf_unordered_map tr1::unordered_map
|
||||||
|
# define gltf_unordered_set set
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -818,8 +818,8 @@ ADD_ASSIMP_IMPORTER( X3D
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_ASSIMP_IMPORTER( GLTF
|
ADD_ASSIMP_IMPORTER( GLTF
|
||||||
AssetLib/glTF/glTFCommon.h
|
AssetLib/glTFCommon/glTFCommon.h
|
||||||
AssetLib/glTF/glTFCommon.cpp
|
AssetLib/glTFCommon/glTFCommon.cpp
|
||||||
AssetLib/glTF/glTFAsset.h
|
AssetLib/glTF/glTFAsset.h
|
||||||
AssetLib/glTF/glTFAsset.inl
|
AssetLib/glTF/glTFAsset.inl
|
||||||
AssetLib/glTF/glTFAssetWriter.h
|
AssetLib/glTF/glTFAssetWriter.h
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006-2020, assimp team
|
# Copyright (c) 2006-2020, assimp team
|
||||||
|
#
|
||||||
|
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use of this software in source and binary forms,
|
# Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -189,8 +188,13 @@ SET( POST_PROCESSES
|
||||||
unit/utGenBoundingBoxesProcess.cpp
|
unit/utGenBoundingBoxesProcess.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SET( FUZZER
|
||||||
|
unit/Fuzzer/utFuzzerTestCases.cpp
|
||||||
|
)
|
||||||
|
|
||||||
SOURCE_GROUP( UnitTests\\Compiler FILES unit/CCompilerTest.c )
|
SOURCE_GROUP( UnitTests\\Compiler FILES unit/CCompilerTest.c )
|
||||||
SOURCE_GROUP( UnitTests\\Common FILES ${COMMON} )
|
SOURCE_GROUP( UnitTests\\Common FILES ${COMMON} )
|
||||||
|
SOURCE_GROUP( UnitTests\\Fuzzer FILES ${FUZZER} )
|
||||||
SOURCE_GROUP( UnitTests\\ImportExport FILES ${IMPORTERS} )
|
SOURCE_GROUP( UnitTests\\ImportExport FILES ${IMPORTERS} )
|
||||||
SOURCE_GROUP( UnitTests\\Material FILES ${MATERIAL} )
|
SOURCE_GROUP( UnitTests\\Material FILES ${MATERIAL} )
|
||||||
SOURCE_GROUP( UnitTests\\Math FILES ${MATH} )
|
SOURCE_GROUP( UnitTests\\Math FILES ${MATH} )
|
||||||
|
@ -202,6 +206,7 @@ add_executable( unit
|
||||||
unit/Main.cpp
|
unit/Main.cpp
|
||||||
../code/Common/Version.cpp
|
../code/Common/Version.cpp
|
||||||
${COMMON}
|
${COMMON}
|
||||||
|
${FUZZER}
|
||||||
${IMPORTERS}
|
${IMPORTERS}
|
||||||
${MATERIAL}
|
${MATERIAL}
|
||||||
${MATH}
|
${MATH}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2020, 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 "UnitTestPCH.h"
|
||||||
|
|
||||||
|
#include <assimp/cimport.h>
|
||||||
|
#include <assimp/Importer.hpp>
|
||||||
|
#include <assimp/scene.h>
|
||||||
|
#include <assimp/postprocess.h>
|
||||||
|
|
||||||
|
using namespace Assimp;
|
||||||
|
|
||||||
|
class utFuzzerTestCases : public ::testing::Test {
|
||||||
|
// empty
|
||||||
|
};
|
||||||
|
|
||||||
|
wchar_t *data = L"vn xx<78> > <20><><EFBFBD><EFBFBD><10><11><>";
|
||||||
|
|
||||||
|
TEST_F(utFuzzerTestCases, testFuzzerData) {
|
||||||
|
aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, NULL);
|
||||||
|
aiAttachLogStream(&stream);
|
||||||
|
|
||||||
|
Importer importer;
|
||||||
|
const aiScene *sc = importer.ReadFileFromMemory(data, 19 * sizeof(wchar_t),
|
||||||
|
aiProcessPreset_TargetRealtime_Quality, nullptr);
|
||||||
|
|
||||||
|
aiDetachLogStream(&stream);
|
||||||
|
EXPECT_EQ(nullptr, sc);
|
||||||
|
}
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
Loading…
Reference in New Issue