[YANGTOOLS-1224] Data codecs may mis-enforce String length constraints Created: 07/Feb/21 Updated: 24/Feb/21 Resolved: 24/Feb/21 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | codecs, data-util |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0, 5.0.9, 6.0.5 |
| Type: | Bug | Priority: | High |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| 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. |