Integer Overflow with Blood Magic Orb #16398
Labels
Bug: Minor
Mod: Avaritia
Status: Ready for Developer
Issue ready for a developer to pick up and implement
Your GTNH Discord Username
jurrejelle
Your Pack Version
2.6.1 (2024-05-20)
Your Server
Private server
Java Version
Java 21
Type of Server
Vanilla Forge
Your Expectation
When a blood orb of armok charges, it shouldn't pass over the integer limit.
The Reality
Picking it up resets it to 1 billion
OnUpdate, it seems to set the current LP to 1,000,000,000 (one billion)
(https://github.com/GTNewHorizons/Avaritia/blob/master/src/main/java/fox/spiteful/avaritia/compat/bloodmagic/ItemOrbArmok.java#L60)
It seems the "currentEssence" is indeed an int (https://github.com/GTNewHorizons/BloodMagic/blob/master/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java#L214)
and (https://github.com/GTNewHorizons/BloodMagic/blob/master/src/main/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java#L10)
There don't seem to be any protections in place for integer overflow.
Your Proposal
it seems that the idea behind the orb is to always have 1 billion LP (onUpdate sets it to 1 bil). Either disable charging when the max orb is armok's, add a limit for the orb, or store the LP value in a long (or similar bigger datatype).
Final Checklist
The text was updated successfully, but these errors were encountered: