The range used in .addAttributes() is wrong, because we're replacing characters of the same range with the indicator variable right before, and the indicator can be shorter than the original range.length.
If the original range was sufficiently long for its length to be greater than the string's length after the indicator replacement, .addAttributes will crash.
Attached is a proposed fix and two simple tests, one passing and one failing before fix, both passing after.
The range used in
.addAttributes()
is wrong, because we're replacing characters of the same range with theindicator
variable right before, and theindicator
can be shorter than the originalrange.length
.If the original range was sufficiently long for its length to be greater than the string's length after the indicator replacement,
.addAttributes
will crash.Attached is a proposed fix and two simple tests, one passing and one failing before fix, both passing after.