[boskid] [1.0.0] LuaPlayer :: set_active_quick_bar_page crash

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
jan1i3
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

[boskid] [1.0.0] LuaPlayer :: set_active_quick_bar_page crash

Post by jan1i3 »

The Problem
set_active_quick_bar_page seems to not validate the second parameter page_index.

This causes it to be setable to 11, which looks like it works, but you actually can't modify that row (only tested by clicking on it)
But when setting it to 12 or higher it causes a crash.
demonstration.png
demonstration.png (223.52 KiB) Viewed 1149 times
This is the main problem, however with just a little more testing i found that there seems to be no validation with these functions:
get_active_quick_bar_page
set_active_quick_bar_page

Code: Select all

/c game.print(game.player.get_active_quick_bar_page(100)) --> nil
/c game.player.set_active_quick_bar_page(100, 100)
/c game.print(game.player.get_active_quick_bar_page(100)) --> nil
As you can see in this code snippet i am setting the 100th quick bar to page 100 and it doesn't crash.
But somehow, i don't know how, i managed to set all 3 of my visible quick bars to 100 without crashing, but setting it (the first one) to 12 afterwards crashed it again.
Then reloading and trying 100 again crashes, so this is very weird and i can't figure out how exactly it works... or doesn't work.
Expected
It should not allow values out of range to be provided in screen_index or page_index.
Note
Considering this was a crash and i have auto crash uploading enabled you may have already fixed it.
But if it's not fixed yet and you'd like me to take a close look at this weird behavior, let me know and i will do so.
Attachments
factorio-current.log
(8.2 KiB) Downloaded 78 times
Also known as JanSharp. jan1i3 was/is my old name ;)

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2227
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.0.0] LuaPlayer :: set_active_quick_bar_page crash

Post by boskid »

Issue was already fixed (for 1.1) by adding a range check for the page_index. If it will be out of acceptable range, LuaPlayer::set_active_quick_bar_page will do nothing.
LuaPlayer::get_active_quick_bar_page returning nil is correct behavior and is well documented.

User avatar
jan1i3
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Sun Dec 09, 2018 1:36 pm
Contact:

Re: [boskid] [1.0.0] LuaPlayer :: set_active_quick_bar_page crash

Post by jan1i3 »

boskid wrote:
Sun Nov 01, 2020 11:00 pm
LuaPlayer::get_active_quick_bar_page returning nil is correct behavior and is well documented.
Oh right, sorry. Always embarrassing when you don't read something that's right in font of your face.
boskid wrote:
Sun Nov 01, 2020 11:00 pm
Issue was already fixed (for 1.1) by adding a range check for the page_index. If it will be out of acceptable range, LuaPlayer::set_active_quick_bar_page will do nothing.
Sounds good, thank you :)
Also known as JanSharp. jan1i3 was/is my old name ;)

Post Reply

Return to “Resolved Problems and Bugs”