Lightman's Currency

Lightman's Currency

2M Downloads

BUG: Depositing a large amount of non-existent money causes server crash

kezmodius opened this issue · 3 comments

commented

Minecraft Version

1.20.1

Forge/NeoForge Version

47.2.23

Lightman's Currency Version

1.20.1-2.2.4.3d

Environment Type

Dedicated Server (Bug/crash happened while connected to a server or while the dedicated server was booting)

Other relevant Mods

Modpack: https://www.curseforge.com/minecraft/modpacks/wolf-craft-colonies

Describe the bug

A player on our server reports:
OK so this is a rather critical bug that crashes the server, and if the server manages to survive it? it'll duplicate trillions of money. if you access the bank from your wallet and try to deposit something like this;
Image
it'll drop THAT number on the ground and cause massive lag, then shuts the server down due to a memory outage.

I tested it and I also crashed the server. Logs, etc below.

To Reproduce

  1. Go to wallet
  2. There needs to be something in the wallet. It did not happen when wallet was empty.
  3. Type in a number higher than what you have in the wallet. I only tested with a crazy high number.
  4. Wait. Nothing seems to happen for a bit. Then the game freezes up and a large dark pile appears beneath you.
  5. Server crashes

Screenshots/Logs/Crash Reports (FILES ONLY)

The player crashed the server then reported
crash-2025-03-06_11.20.35-server.txt

My test after report
crash-2025-03-06_12.16.43-server.txt

My client log - test is right at the end.
latest.log

commented

So it does... this is very concerning that it behaves like this as it's supposed to have a check in there to shrink the requested deposit amount to the amount of money actually in the coin slots before actually acting on anything...

commented

Update: I discovered the issue that was happening here. Whenever you were attempting to define a deposit amount larger than is physically possible (cause integers can only get so big), the requested deposit amount was wrapping back around to negative numbers (as it's casting a long to an int), which means that it'll pass the inspection (-5 billion is less than the 5 coins available), attempt to insert the given amount, and then have a large negative value after insertion which it will then attempt to give back to you as change. Fortunately this is a fairly easy issue to catch so it should be fixed in the next version.

commented

Fixed in v2.2.4.4. Thank you for reporting!