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

Crash when the sum of enchantments' weights overflow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w20a
    • 24w18a
    • None
    • Confirmed
    • Crash, Data Packs
    • Important
    • Platform

      Summary
      When an enchantment has a big weight (close to Integer.MAX_VALUE), adding other enchantments' weights will make the total exceed the integer limit, causing a crash.

      Steps to Reproduce

      1. Create a world with the attached data pack, which makes the Sharpness enchantment have Integer.MAX_VALUE weight.
      2. Summon a villager.
      3. Place a grindstone.

      Expected Result
      The data pack should fail to load, or no crash should occur.

      Actual Result
      Game crashes.

        1. Confirmed..PNG
          17 kB
          BugTracker
        2. crash-2024-05-07_20.34.08-server.txt
          6 kB
          apple502j
        3. deobf_crash-2024-05-07_20.34.08-server.txt
          21 kB
          [Bot] Arisa

            slicedlime [Mojang] slicedlime
            apple502j apple502j
            Votes:
            4 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: