GabrieleGiuseppini / Floating-Sandbox

Mass-spring network in C++, simulating physical bodies floating in water and sinking
Other
57 stars 30 forks source link

Crash when loading a Ship Preview Database on ARM #43

Closed GabrieleGiuseppini closed 3 years ago

GabrieleGiuseppini commented 4 years ago

There is an access alignment issue when de-serializing index entries:


ShipPreviewImageDatabase::DeserializeIndexEntry (buffer=std::vector of length 15974, capacity 15974 = {...}, bufferIndex=67, filename=filesystem::path "", lastModified=..., position=..., size=@0xc85c6884: 35200, dimensions=...)
    at /path/to/fs/Game/ShipPreviewImageDatabase.cpp:67
67      position = indexEntry->Position;`
(gdb) where
#0  0x001a7050 in ShipPreviewImageDatabase::DeserializeIndexEntry(std::vector<char, std::allocator<char> > const&, unsigned int, std::filesystem::__cxx11::path&, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long long, std::ratio<1ll, 1000000000ll> > >&, std::fpos<__mbstate_t>&, unsigned int&, ImageSize&)
    (buffer=std::vector of length 15974, capacity 15974 = {...}, bufferIndex=67, filename=filesystem::path "", lastModified=..., position=..., size=@0xc85c6884: 35200, dimensions=...)
    at/path/to/fs/ShipPreviewImageDatabase.cpp:67
#1  0x001a7774 in PersistedShipPreviewImageDatabase::Load(std::filesystem::__cxx11::path const&, std::shared_ptr<IFileSystem>) (databaseFilePath=..., fileSystem=...)
    at/path/to/fs/Game/ShipPreviewImageDatabase.cpp:199
#2  0x001a2824 in ShipPreviewDirectoryManager::Create(std::filesystem::__cxx11::path const&, std::shared_ptr<IFileSystem>) (directoryPath=..., fileSystem=...)
    at/path/to/fs/Game/ShipPreviewDirectoryManager.cpp:32
#3  0x001a2578 in ShipPreviewDirectoryManager::Create(std::filesystem::__cxx11::path const&) (directoryPath=<error reading variable: Cannot access memory at address 0x5f>...)
    at/path/to/fs/Game/ShipPreviewDirectoryManager.cpp:19
#4  0x0010a098 in ShipPreviewWindow::ScanDirectory(std::filesystem::__cxx11::path const&) (this=0x66a51f0, directoryPath=...)
    at/path/to/fs/FloatingSandbox/ShipPreviewWindow.cpp:878
#5  0x001080cc in ShipPreviewWindow::RunPreviewThread() (this=0x66a51f0)
    at /path/to/fs/FloatingSandbox/ShipPreviewWindow.cpp:859```
GabrieleGiuseppini commented 4 years ago

I've pushed a possible fix (to the usual multithreaded_rendering branch) - can you test whether loading ships multiple times from the same folder still crashes?

DonFlymoor commented 4 years ago

I can load as many ships as I want until I restart FS. Then pressing ctrl+o crashes the game.

GabrieleGiuseppini commented 4 years ago

Oh right, sure, sorry. Just start FS, open the "Ship Explorer", wait a few secs, close the window and FS, restart FS and open the "Ship Explorer" again.

GabrieleGiuseppini commented 4 years ago

Hi, is the Ship Explorer still crashing after the latest pull?

GabrieleGiuseppini commented 3 years ago

I've fixed alignment issues with the ship preview database, hence closing. Please reopen if you're still hitting this issue.