mojira.dev
MC-271753

Crash due to overflow inside cost calculation in by_cost_with_difficulty

When the by_cost_with_difficulty enchantment provider calculates the cost, the maximum value may overflow, causing max - min + 1 to be zero or below. This causes a crash.

Steps to Reproduce

  1. Create a new world with the attached data pack.

  2. Place a zombie spawner.

  3. Ensure the local difficulty is near the maximum (set the difficulty to Hard, and advance inhabited time/time of day; using pre-existing world might be a better idea)

  4. Wait.

Expected Result
Game does not crash.

Actual Result
Game crashes.

Attachments

Comments 3

I wasn't able to reproduce this, the game didn't seem to crash. Can you please provide a video showcasing the crash?

I believe the clamped local difficulty (as seen on F3, after two slashes) needs to be 1.00.

I also was unable to reproduce this issue, but I'll mark this report as Plausible since a credible description and crash report have been attached.

apple502j

Tommy Wallberg

Plausible

Platform

Very Important

Crash, Data Packs, Enchantments

24w18a

24w21a

Retrieved