Repository navigation
Closed
Description
Describe the bug
While attempting to import the "truck.3mf" model from three.js , an application prints "free(): invalid size" and crashes.
To Reproduce
- Browse to https://github.com/mrdoob/three.js/blob/dev/examples/models/3mf and download the "truck.3mf" model (2.6 MBytes).
- Run the Assimp tool:
assimp info truck.3mf - See the error message, either "double free or corruption (out)" or "free(): invalid size"
Expected behavior
aiImportFile() should return without crashing, either with an imported data structure or else (in case the model is invalid) with diagnostic information.
Screenshots
Here is the output of my application, with verbose logging enabled:
Info, T0: Load truck.3mf
Debug, T0: Assimp 5.2.0 amd64 gcc shared singlethreadedsingle :
Info, T0: Found a matching importer for this file format: 3mf Importer.
Info, T0: Import root directory is './'
Warn, T0: Ignored file of unknown type: 3D/3dmodel.model
Warn, T0: Ignored file of unknown type: 3D/Texture/CMC_LOGO_COLOR.png
Warn, T0: Ignored file of unknown type: 3D/_rels/3dmodel.model.rels
Warn, T0: Ignored file of unsupported type CONTENT_TYPES_ARCHIVES[Content_Types].xml
Debug, T0: 3D/3dmodel.model
Debug, T0: UpdateImporterScale scale set: 1
Debug, T0: ValidateDataStructureProcess begin
Error, T0: Validation failed: aiTexture::achFormatHint contains non-lowercase letters
free(): invalid sizeHere is the output of the Assimp tool (built with -DASSIMP_ASAN=On at Git hash a7cfa32 ):
Launching asset import ... OK
Validating postprocessing flags ... OK
=================================================================
==20004==ERROR: AddressSanitizer: heap-use-after-free on address 0x619000002398 at pc 0x7f6fb1bde014 bp 0x7ffe0264ea60 sp 0x7ffe0264ea50
READ of size 8 at 0x619000002398 thread T0
#0 0x7f6fb1bde013 in Assimp::ValidateDSProcess::Validate(aiTexture const*) /home/sgold/NetBeansProjects/ext/assimp/code/PostProcessing/ValidateDataStructure.cpp:700
#1 0x7f6fb1be18f3 in void Assimp::ValidateDSProcess::DoValidation<aiTexture>(aiTexture**, unsigned int, char const*, char const*) (/home/sgold/NetBeansProjects/ext/assimp/build/bin/libassimpd.so.5+0x6ee8f3)
#2 0x7f6fb1bd965e in Assimp::ValidateDSProcess::Execute(aiScene*) /home/sgold/NetBeansProjects/ext/assimp/code/PostProcessing/ValidateDataStructure.cpp:225
#3 0x7f6fb1a60ea0 in Assimp::BaseProcess::ExecuteOnScene(Assimp::Importer*) /home/sgold/NetBeansProjects/ext/assimp/code/Common/BaseProcess.cpp:86
#4 0x7f6fb1a7e0b5 in Assimp::Importer::ReadFile(char const*, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/code/Common/Importer.cpp:731
#5 0x56265277ded1 in Assimp::Importer::ReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/include/assimp/Importer.hpp:670
#6 0x56265277b355 in ImportModel(ImportData const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Main.cpp:307
#7 0x5626527867a3 in Assimp_Info(char const* const*, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Info.cpp:344
#8 0x56265277adc1 in main /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Main.cpp:222
#9 0x7f6fb0fbfd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#10 0x7f6fb0fbfe3f in __libc_start_main_impl ../csu/libc-start.c:392
#11 0x5626527525c4 in _start (/home/sgold/NetBeansProjects/ext/assimp/build/bin/assimpd+0x185c4)
0x619000002398 is located 24 bytes inside of 1064-byte region [0x619000002380,0x6190000027a8)
freed by thread T0 here:
#0 0x7f6fb35d024f in operator delete(void*, unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:172
#1 0x7f6fb29d6dab in Assimp::D3MF::D3MFOpcPackage::~D3MFOpcPackage() /home/sgold/NetBeansProjects/ext/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp:190
#2 0x7f6fb29d56aa in Assimp::D3MFImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*) /home/sgold/NetBeansProjects/ext/assimp/code/AssetLib/3MF/D3MFImporter.cpp:121
#3 0x7f6fb1a42861 in Assimp::BaseImporter::ReadFile(Assimp::Importer*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Assimp::IOSystem*) /home/sgold/NetBeansProjects/ext/assimp/code/Common/BaseImporter.cpp:135
#4 0x7f6fb1a7da76 in Assimp::Importer::ReadFile(char const*, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/code/Common/Importer.cpp:709
#5 0x56265277ded1 in Assimp::Importer::ReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/include/assimp/Importer.hpp:670
#6 0x56265277b355 in ImportModel(ImportData const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Main.cpp:307
#7 0x5626527867a3 in Assimp_Info(char const* const*, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Info.cpp:344
#8 0x56265277adc1 in main /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Main.cpp:222
#9 0x7f6fb0fbfd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
previously allocated by thread T0 here:
#0 0x7f6fb35cf1e7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
#1 0x7f6fb29d7576 in Assimp::D3MF::D3MFOpcPackage::LoadEmbeddedTextures(Assimp::IOStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/sgold/NetBeansProjects/ext/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp:243
#2 0x7f6fb29d6798 in Assimp::D3MF::D3MFOpcPackage::D3MFOpcPackage(Assimp::IOSystem*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/sgold/NetBeansProjects/ext/assimp/code/AssetLib/3MF/D3MFOpcPackage.cpp:178
#3 0x7f6fb29d53e8 in Assimp::D3MFImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*) /home/sgold/NetBeansProjects/ext/assimp/code/AssetLib/3MF/D3MFImporter.cpp:105
#4 0x7f6fb1a42861 in Assimp::BaseImporter::ReadFile(Assimp::Importer*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Assimp::IOSystem*) /home/sgold/NetBeansProjects/ext/assimp/code/Common/BaseImporter.cpp:135
#5 0x7f6fb1a7da76 in Assimp::Importer::ReadFile(char const*, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/code/Common/Importer.cpp:709
#6 0x56265277ded1 in Assimp::Importer::ReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/include/assimp/Importer.hpp:670
#7 0x56265277b355 in ImportModel(ImportData const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Main.cpp:307
#8 0x5626527867a3 in Assimp_Info(char const* const*, unsigned int) /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Info.cpp:344
#9 0x56265277adc1 in main /home/sgold/NetBeansProjects/ext/assimp/tools/assimp_cmd/Main.cpp:222
#10 0x7f6fb0fbfd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: heap-use-after-free /home/sgold/NetBeansProjects/ext/assimp/code/PostProcessing/ValidateDataStructure.cpp:700 in Assimp::ValidateDSProcess::Validate(aiTexture const*)
Shadow bytes around the buggy address:
0x0c327fff8420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff8430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff8440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff8450: 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff8460: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c327fff8470: fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff8480: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff8490: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff84a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff84b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fff84c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: ccPlatform (please complete the following information):
- OS: Mint Linux
- Browser: Firefox
Additional context
n/a
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fields✅ Done
Activity
tellypresence commentedon Nov 8, 2023
Confirm catastrophic crash in my implementation
kimkulling commentedon Nov 14, 2023
Got the issue, the fix is on its way. Thanks for your report!
tellypresence commentedon Nov 16, 2023
Model no longer crashes, but in my implementation load never finishes, no apparent errors unfortunately
stephengold commentedon Nov 16, 2023
may need to open a new issue for that
tellypresence commentedon Nov 16, 2023
@stephengold Could you please verify whether you are able to successfully load
truck.3mfwith the fix (and if so attach a screenshot for future reference)?(We may be in "did this model ever work?" territory here...)
stephengold commentedon Nov 16, 2023
My application is LWJGL-based. The most recent LWJGL snapshot was built at Git hash 46b19cc, a week before #5325 was integrated into the "master" branch. After the next LWJGL snapshot is published, I'll re-test and report back here (with a screenshot, if I get one).
stephengold commentedon Nov 17, 2023
While waiting for an LWJGL snapshot, I re-tested using the
assimp infocommand, built at Git hash 6004290.Since that test passed, it seems like the issue is truly resolved.
stephengold commentedon Nov 23, 2023
When I use LWJGL 3.3.4 snapshot build 2 (built at Assimp git hash 56e0ba5) my application still crashes while importing truck.3mf, but with a different diagnostic. Here is the output of my application with verbose logging enabled:
Since I don't have authorization to re-open this issue, I'll follow up at issue #5328.