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 importing image as FontData if setting rows to 0 #91812

Closed
noidexe opened this issue May 10, 2024 · 3 comments · Fixed by #91829
Closed

Crash when importing image as FontData if setting rows to 0 #91812

noidexe opened this issue May 10, 2024 · 3 comments · Fixed by #91829

Comments

@noidexe
Copy link
Contributor

noidexe commented May 10, 2024

Tested versions

  • Reproducible in: 4.3-dev6, 4.2.1

System information

Windows 10.0.22631 - Vulkan (Forward+) - dedicated AMD Radeon RX 6700S (Advanced Micro Devices, Inc.; 31.0.24031.5001) - AMD Ryzen 9 6900HS with Radeon Graphics (16 Threads)

Issue description

When importing an image as FontData, setting "rows" to 0 in the Import tab and reimporting crashes the editor

Steps to reproduce

  • Open the attacked MRP
  • In the Filesystem dock select "TimerNumbers_10.png"
  • Go to the Import tab
  • Set rows to 0
  • Reimport
    Expected: An error is shown into the console since 0 is an invalid value
    Actual: The editor crashes and the invalid value gets saved in the .import file

This is just an example, you can cause the same crash by setting columns to 0

Other errors, like having a total character range exceeding rows*columns show properly without causing any crashes

Minimal reproduction project (MRP)

fontdata-mrp.zip

@Rubonnek
Copy link
Member

Could you test if it's reproducible in 4.3dev5?

@noidexe
Copy link
Contributor Author

noidexe commented May 10, 2024

The error seems to be here:

int chr_cell_width = (img->get_width() - img_margin.position.x - img_margin.size.x) / columns;

columns and rows are used as divisors. There should be an ERR_FAIL_COND if they are 0

@noidexe
Copy link
Contributor Author

noidexe commented May 10, 2024

Could you test if it's reproducible in 4.3dev5?

It is.

@akien-mga akien-mga added this to the 4.3 milestone May 11, 2024
alesliehughes added a commit to alesliehughes/alesliehughes-godot that referenced this issue May 11, 2024
alesliehughes added a commit to alesliehughes/alesliehughes-godot that referenced this issue May 11, 2024
dimitry- pushed a commit to AndroidWasm/godot that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants