[ModAPI] IMySurvivalBuff Level property has no safety, crashes game if set out of bounds

gruzzob shared this bug 20 days ago
Reported

This one is one bug and one... lack of access that interact in an unfortunate way.

The first:

The .Level property of the IMySurvivalBuff interface can be set higher than the maximum level available from the defined buff, or lower than 0. This will cause a IndexOutOfBoundsException as the .Level property is used to directly index in to the array containing the buff values in .ApplyBuff() on the object backing the IMySurvivalBuff interface... on all the backing types.


Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at SpaceEngineers.Game.EntityComponents.GameLogic.Buffs.MyMaxHealthBuff.ApplyBuff()

The second:

We don't have an apparent way of getting the maximum level a buff can get to. The Definitions aren't whitelisted for the ModAPI, and we don't have an easy or apparent way to get from the IMySurvivalBuff interface to the Definition used to provide it with data even if we could read those definitions.

The implications of that is that we can't check for trying to set an out of bounds value on the survival buff ourselves.

Replies (1)

photo
1

Hello Engineer,

Thank you for reaching out to us on the forum.

Could you please share the script/MOD where you’re encountering this issue?

  • If it's a local MOD, you can find it in your AppData\Roaming\SpaceEngineers\Mods folder. Please zip your MOD folder and attach it here.
  • If it’s published on Steam or Mod-io Workshop, please share the link instead.

Also, please share the grid setup you’re using with this script/MOD. This information will help us investigate the issue further.

Kind regards,

Keen Software House: QA Department

photo
1

Hello QA.

Please see mod attached. It's a minimum reproduction of the .Level crash.

Start a game (with survival buffs enabled), and then press L to increase the level of all buffs by one. Doing this six times will cause the game to crash. No grid is needed for this minimum reproduction.

A log from this is attached.

(In hindsight I probably should have done all this on the original post)

Thanks,

gruzzob

photo
1

Hello Engineer,

thank you for providing the mod.

We have reproduced the issue on our side and put it into our internal system.

Kind regards,

Keen Software House: QA Department

photo
Leave a Comment
 
Attach a file
You can't vote. Please authorize!