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

Bugfix: AIM: insert items into container in corpse #68113

Conversation

inogenous
Copy link
Contributor

@inogenous inogenous commented Sep 12, 2023

Summary

Bugfixes "AIM: Prevent segfault when inserting items into container in corpse"

Purpose of change

  • Fixes Using Advanced Inventory to put items into containers on corpses crashes the game. (segmentation fault) #67949 .
  • Prevents segfault in AIM when inserting items into a toplevel container that is carried by a corpse.
  • How to reproduce issue being resolved:
    1. Stand adjacent to corpse
    2. Corpse is wearing "French maid clothes" (or some other container)
    3. Enter AIM, have "all" on left and "inventory" on right
    4. Navigate to "French maid clothes" on left and press c to open it as container
    5. Switch to right AIM pane and navigate to an item in your inventory, for example "matchbook"
    6. Press enter to move "matchbook" into "French maid clothes"
    7. Segfault

Describe the solution

  • Thanks to @andrei8l for pointing out the problem in Using Advanced Inventory to put items into containers on corpses crashes the game. (segmentation fault) #67949 (comment)
  • The location for advanced_inv_listitem aim_item previously pointed to a container located at loc_cursor. But this location is the location of the corpse.
  • Therefore, this suggested change is to switch the containers relative location:
    • item_location( loc_cursor, loot ) (before): would mean that the container is placed on the same location as the corpse
    • item_location( loc_cursor, it ) (used by this change): is the corpse (it) represented as a container
    • item_location( item_location( loc_cursor, it ), loot ) (used by this change) is then the container loot inside (the corpse represented as a container)

Describe alternatives you've considered

Testing

Additional context

* Prevents segfault in AIM when inserting items into a toplevel container that is carried by a corpse.
* How to reproduce issue being resolved:
	1. Stand adjacent to corpse
	2. Corpse is wearing "garter belt"
	3. Enter AIM, have "all" on left and "inventory" on right
	4. Navigate to "garter belt" on left and press `c` to open it as container
	5. Switch to right AIM pane and navigate to an item in your inventory, for example "matchbook"
	6. Press enter to move "matchbook" into "garter belt"
	7. Segfault
@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Sep 12, 2023
@Maleclypse Maleclypse merged commit 398e915 into CleverRaven:master Sep 12, 2023
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Advanced Inventory to put items into containers on corpses crashes the game. (segmentation fault)
2 participants