Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-271753

Crash due to overflow inside cost calculation in by_cost_with_difficulty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w21a
    • 24w18a
    • None
    • Plausible
    • Crash, Data Packs, Enchantments
    • Very Important
    • Platform

      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.

        1. crash-2024-05-08_21.08.25-server.txt
          6 kB
          apple502j
        2. deobf_crash-2024-05-08_21.08.25-server.txt
          16 kB
          [Bot] Arisa

            TommyWallberg [Mojang] TommyWallberg
            apple502j apple502j
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: