From 46e0e3339ce6850630b22a7bad9667bec176acf1 Mon Sep 17 00:00:00 2001 From: Roggie Zhang Date: Thu, 9 Jan 2025 10:46:03 +0800 Subject: [PATCH] Check fileOffset --- pxr/usd/plugin/usdAbc/alembicReader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pxr/usd/plugin/usdAbc/alembicReader.cpp b/pxr/usd/plugin/usdAbc/alembicReader.cpp index 00fd5ea30d..d198d4343b 100644 --- a/pxr/usd/plugin/usdAbc/alembicReader.cpp +++ b/pxr/usd/plugin/usdAbc/alembicReader.cpp @@ -894,8 +894,11 @@ _ReaderContext::_OpenAndGetMappedFilePath(const std::string& filePath) ArGetResolver().OpenAsset(ArResolvedPath(filePath)); if (asset) { - FILE* fileHandle = asset->GetFileUnsafe().first; - if (fileHandle && ftell(fileHandle) == 0) + FILE* fileHandle; size_t fileOffset; + std::tie(fileHandle, fileOffset) = asset->GetFileUnsafe(); + // Check file offset also to ensure that the .abc file + // we're looking at isn't embedded in a .usdz or other package + if (fileHandle && fileOffset == 0) { // If file handle is presented, use mapped file path instead of original one. const std::string mappedFilePath = ArchGetFileName(fileHandle);