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

Vulkan: Godot crashes when baking lightmaps with large lightmap size it sets after unwrapping lightmap UVs #70695

Closed
solek1312 opened this issue Dec 29, 2022 · 3 comments

Comments

@solek1312
Copy link

solek1312 commented Dec 29, 2022

Godot version

4.0 Beta 10

System information

Linux Mint 21, Vulkan, Intel Iris Xe (Intel i5-1135G7)

Issue description

Godot sets unreasonably large "Lightmap Size Hint" values to imported after making lightmap UVs, which crashes the editor when baking lightmaps.

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta10.official (d0398f62f08ce0cfba80990b21c6af4181f93fe9)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7ff3064a9520] (??:0)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x1afbba) [0x7ff306616bba] (??:0)
[3] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x413b256] (??:0)
[4] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x14564d5] (??:0)
[5] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x4720557] (??:0)
[6] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x21d884f] (??:0)
[7] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x21d91ba] (??:0)
[8] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x444618a] (??:0)
[9] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x1b27d4e] (??:0)
[10] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x444618a] (??:0)
[11] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2b9c17b] (??:0)
[12] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x444618a] (??:0)
[13] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2b2f479] (??:0)
[14] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2b2fc8c] (??:0)
[15] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2b2ffca] (??:0)
[16] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2aa44b5] (??:0)
[17] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2af58b5] (??:0)
[18] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2af9c41] (??:0)
[19] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2afa21b] (??:0)
[20] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x2aada15] (??:0)
[21] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0xe40dd4] (??:0)
[22] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x41df1a7] (??:0)
[23] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0x41e0025] (??:0)
[24] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0xe43bdd] (??:0)
[25] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0xdbfa42] (??:0)
[26] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7ff306490d90] (??:0)
[27] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7ff306490e40] (??:0)
[28] /home/tim/Godot/Godot_v4.0-beta10_linux.x86_64() [0xde127e] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

  1. Import a mesh
  2. Prepare a scene for baking a lightmap, creating lightmap UVs for meshes in the process
  3. Begin baking

Minimal reproduction project

TestLightmap.zip

@Chaosus Chaosus added this to the 4.0 milestone Dec 29, 2022
@Chaosus Chaosus moved this from To Assess to Todo in 4.x Priority Issues Dec 29, 2022
@stmSi
Copy link
Contributor

stmSi commented Dec 29, 2022

Setting Lightmap Size Hint really high (like 9000x9000) make integer overflow and size becoming negative value... using that in memset.. crashes the editor.
Inside core/io/image.cpp:1608 Image::_get_dst_image_size function, see the calculation of s (bw * bh * pixsize).

May be we should limit the Lightmap Size with some MAX value.

@solek1312 solek1312 changed the title Vulkan: Godot always crashes when baking lightmaps Vulkan: Godot crashes when baking lightmaps with large lightmap size Dec 31, 2022
@solek1312
Copy link
Author

Setting Lightmap Size Hint really high (like 9000x9000) make integer overflow and size becoming negative value... using that in memset.. crashes the editor. Inside core/io/image.cpp:1608 Image::_get_dst_image_size function, see the calculation of s (bw * bh * pixsize).

May be we should limit the Lightmap Size with some MAX value.

Sorry, haven't even noticed, just clicked "Unwrap UV2 for Lightmap/AO" and didn't notice it set the size to a huge value. It works With a manually-entered value

@solek1312 solek1312 changed the title Vulkan: Godot crashes when baking lightmaps with large lightmap size Vulkan: Godot crashes when baking lightmaps with large lightmap size it sets after unwrapping lightmap UVs Dec 31, 2022
@Calinou
Copy link
Member

Calinou commented Dec 31, 2022

Duplicate of #54679.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2022
@github-project-automation github-project-automation bot moved this from Todo to Done in 4.x Priority Issues Dec 31, 2022
@Calinou Calinou removed this from the 4.0 milestone Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants