Merge pull request #3946 from mahiuchun/safe

glTF2: Make handling of embedded textures safer.
pull/3961/head^2
Kim Kulling 2021-06-21 19:02:43 +02:00 committed by GitHub
commit 43a5c6c8e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -515,9 +515,8 @@ void glTF2Exporter::GetMatTex(const aiMaterial* mat, Ref<Texture>& texture, aiTe
std::string imgId = mAsset->FindUniqueID("", "image");
texture->source = mAsset->images.Create(imgId);
if (path[0] == '*') { // embedded
aiTexture* curTex = mScene->mTextures[atoi(&path[1])];
const aiTexture* curTex = mScene->GetEmbeddedTexture(path.c_str());
if (curTex != nullptr) { // embedded
texture->source->name = curTex->mFilename.C_Str();
//basisu: embedded ktx2, bu