-
Notifications
You must be signed in to change notification settings - Fork 2k
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
set_list(..., {}) incorrectly forbidden in certain cases ("cannot be deleted or resized") #13465
Comments
Related: #13466 |
This diff fixed the issue for me. Might it be possible for you to check whether there are any follow-up issues in your workflow? diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp
index 1c6b3ffc9..c3cf8d5bf 100644
--- a/src/inventorymanager.cpp
+++ b/src/inventorymanager.cpp
@@ -279,9 +279,6 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
return;
}
- auto list_from_lock = list_from->resizeLock();
- auto list_to_lock = list_to->resizeLock();
-
if (move_somewhere) {
s16 old_to_i = to_i;
u16 old_count = count;
@@ -326,6 +323,9 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
return;
}
+ auto list_from_lock = list_from->resizeLock();
+ auto list_to_lock = list_to->resizeLock();
+
if (from_i < 0 || list_from->getSize() <= (u32) from_i) {
infostream << "IMoveAction::apply(): FAIL: source index out of bounds: "
<< "size of from_list=\"" << list_from->getSize() << "\""
PS: To be technically correct, Minetest does not crash. It throws a Lua error. Crashes are unclean application terminations caused by e.g. segmentation faults. |
That would just disable the mitigation for this case, which is not good. |
@Desour The diff is valid because the function is called recursive. All script callbacks are still protected by the locks. The difference is that |
The script callbacks don't need to be protected, but the borrowed references (i.e. |
Minetest version
minetest/minetest_game@1e237b8
OS / Hardware
Operating system: Fedora Linux 37 (Workstation Edition)
CPU: Intel® Core™ i7-4790K × 8
Summary & Steps to reproduce
You can put an itemstack into MTG's creative inventory trash field (thus "deleting" the itemstack) by shift-clicking it.
Since 0fb6dba, if I try to put any itemstack into the trash by shift-click, Minetest crashes. This does not happen if I put items into the trash field "by hand".
That this only happens since 0fb6dba (PR #13360) is why I'm opening the issue here rather than in the MTG repo.
The text was updated successfully, but these errors were encountered: