Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1224

Data codecs may mis-enforce String length constraints

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • High
    • Resolution: Done
    • None
    • 7.0.0, 5.0.9, 6.0.5
    • codecs, data-util

    Description

      RFC7950 states that:

       A "length" statement restricts the number of Unicode characters in
       the string.

      This is distinct diffrent what java.lang.String.length() provides:

      Returns the length of this string. The length is equal to the number of Unicode code units in the string.

      with the following (from java.lang.Character):

      In the Java SE API documentation, Unicode code point is used for character values in the range between U+0000 and U+10FFFF,
      and Unicode code unit is used for 16-bit char values that are code units of the UTF-16 encoding.

      We should not be checking the String.length(), but rather String.codePointCount(). Audit all enforcement points for correct checks.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              rovarga Robert Varga
              rovarga Robert Varga
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: