Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when building mesh from certain .map files #38

Open
Muha0644 opened this issue Nov 9, 2022 · 4 comments
Open

Crash when building mesh from certain .map files #38

Muha0644 opened this issue Nov 9, 2022 · 4 comments

Comments

@Muha0644
Copy link

Muha0644 commented Nov 9, 2022

Rebuilding the mesh with a "bad" .map file reliably causes godot to crash with the following error:

*** stack smashing detected ***: terminated
[1]    28334 IOT instruction (core dumped)  "/home/user/bin/godot4"

The issue (from my testing) seems to be entirely preventable in Trenchbroom itself. The crash only happens when a parent folder is loaded in the "texture collection" panel in the "faces" tab in TB. For example, if I have the following folder structure in my project:

/textures
| -/epic_textures
| | -/red
| | | files...
| | -/green
| | | files...
| | -/blue
| | | files...

selecting all the child folders works flawlessly, but if I include epic textures in the TB menu, it causes a crash when building the mesh in godot.

I have verified this by editing the generated .map file using a text editor, removing the parent folder from "_tb_textures" fixes the crash:

-"_tb_textures" "textures/epic_textures;textures/epic_textures/green;textures/epic_textures/blue;textures/epic_textures/red"
+"_tb_textures" "textures/epic_textures/green;textures/epic_textures/blue;textures/epic_textures/red"
@codecat
Copy link
Owner

codecat commented Nov 11, 2022

Hm, I can't seem to reproduce this (on Windows). Can you post a map file and a folder of textures that can reproduce this?

@Muha0644
Copy link
Author

I've made an example project and tested it, it indeed crashes with the same error. I've tested it on two computers so far. Here is the project: test.zip

@andreymal
Copy link

@codecat this is probably because the buf[255] array is overflowing.

A minimal .map file that crashes latest TBLoader on my Linux:

{
"mapversion" "220"
"classname" "worldspawn"
"_tb_textures" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
}

@codecat
Copy link
Owner

codecat commented Feb 27, 2023

Nice catch! Thanks for the tip 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants