m2wasabi / VRMQuickMetaLoader

load quick VRM.Meta information
MIT License
24 stars 1 forks source link

Unity crashes during MemCpy in MetaLoaderInternal #5

Open TigerHix opened 1 year ago

TigerHix commented 1 year ago

Hello, just found this gem repo and couldn't wait to test it out. Unfortunately, when loading any VRM file that I have locally, Unity just crashed with stacktrace below:

Received signal SIGSEGV
Obtained 33 stack frames
0x00007ff603fa71b7 (Unity) UnsafeUtility_CUSTOM_MemCpy
0x000001bf6fb0a678 (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:MemCpy (void*,void*,long)
0x000001c205f9a8a3 (Mono JIT Code) [MetaLoaderInternal.cs:100] VRM.QuickMetaLoader.MetaLoaderInternal:LoadThumbnailBin (int) 
0x000001c205f9a5d3 (Mono JIT Code) [MetaLoaderInternal.cs:72] VRM.QuickMetaLoader.MetaLoaderInternal:LoadThumbnail () 
0x000001c205f9a52b (Mono JIT Code) [MetaLoader.cs:31] VRM.QuickMetaLoader.MetaLoader:LoadThumbnail () 

Maybe VRM/GLTF format has updated somehow so that some of the parsing code needs to be updated?

Would highly appreciate if you could share some thoughts or give some pointers on this. Thanks so much!

TigerHix commented 1 year ago

Turns out I have to do a metaLoader.Read() first. 😛

I did notice a bug:

image

There needs to be a return statement added in StringDeconstructHelper or there will be a null reference at line 16.