Commons Lang
  1. Commons Lang
  2. LANG-3

[lang] PADDING array in StringUtils overflows on '\uffff'

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: lang.*
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

      Description

      The PADDING array in class StringUtils is one entry too short.
      As declared, it overflows on '\uffff'.
      To test, run:
      StringUtils.leftPad("abcd", 10, '\ufffe') // no exception
      StringUtils.leftPad("abcd", 10, '\uffff') // ArrayIndexOutOfBoundsException

      Current code:
      private static final String[] PADDING = new String[Character.MAX_VALUE];
      Suggested fix:
      private static final String[] PADDING = new String[Character.MAX_VALUE + 1];

        Activity

        Mark Thomas made changes -
        Workflow jira [ 12371281 ] Default workflow, editable Closed status [ 12602389 ]
        Henri Yandell made changes -
        Component/s lang.* [ 12313203 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Henri Yandell made changes -
        Fix Version/s 2.2 [ 12311702 ]
        Henri Yandell made changes -
        Affects Version/s 2.1 Final [ 12311701 ]
        Henri Yandell made changes -
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Component/s Lang [ 12311121 ]
        Fix Version/s 2.2 [ 12311686 ]
        Affects Version/s 2.1 Final [ 12311659 ]
        Key COM-2224 LANG-3
        Project Commons [ 12310458 ] Commons Lang [ 12310481 ]
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 35756 12342376
        Hide
        Stephen Colebourne added a comment -

        Patch applied, thanks

        Show
        Stephen Colebourne added a comment - Patch applied, thanks
        Reuben Sivan created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Reuben Sivan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development