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

Mth.ceil(float) and Mth.ceil(double) can overflow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Invalid
    • Affects Version/s: 20w17a
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Plausible
    • Category:
      (Unassigned)

      Description

      The bug

      20w17a, Mojang names

      The methods net.minecraft.util.Mth.ceil(float) and ceil(double) are supposed to return the smallest int which is equal or greater than the given float / double.
      The problem is that if the argument is > Integer.MAX_VALUE, the result overflows and becomes Integer.MIN_VALUE.

      Maybe that is acceptable though because usually these methods are not called with such high values.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            marcono1234 [Mod] Marcono1234
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              CHK: