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

Fraction value provider allows division by zero

XMLWordPrintable

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

      Summary
      fraction enchantment value provider allows division by zero. If the numerator is not zero, the result is Infinity. If it is also zero, the result is NaN. Feeding these values to the game causes various unexpected effects, such as deadlocking the internal server.

      Steps to Reproduce

      1. Create a world with attached data pack. It adds a boots enchantment, test:boom, which has a knockback multiplier of 1 / 0 or Infinity.
      2. Give yourself a pair of boots with the test:boom enchantment.
      3. Summon another entity (e.g. a pig).
      4. Wear the boots.
      5. Walk. (This causes infinite-knockback explosions.)
      6. Interact with the game (e.g. punching pigs).
      7. Try to exit the game.

      Expected Result
      Game works normally; the world can be interacted with, and it can be closed.

      Actual Result
      Internal server stops responding. (Because my testing was done on integrated server, this does not log anything of interest; dedicated server might produce a watchdog crash.)

      I'm sure there are many other interesting effects achievable by feeding NaN or Infinity, but just reporting a simple example here.

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

              Created:
              Updated:
              Resolved:
              CHK: