Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-249

Check for max Short seems wrong

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 6.0
    • None
    • None

    Description

      There are some checks for the max value that will fit in a short.
      These are of the form:

      if (Math.abs(value) >= 32767)
      

      This seems wrong, as Short.MAX_VALUE = 32767, so the check should be

      if (Math.abs(value) > 32767)
      

      There's a further problem, which is that Short.MIN_VALUE = -32768.
      This will be disallowed, unless the condition is written as:

      if ((value >= -32768) && (value <= 32767))
      

      This is how the ctor generic.PUSH.PUSH(ConstantPoolGen cp, int value) does the check.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: