Repository navigation
Commit cc75830
committed
Normalize lone surrogate halves at the clipText boundary
clipText only repaired lone halves its own cut created, so untrusted
input that already contained a lone surrogate in the middle passed
through and still broke UTF-8 consumers (a Postgres insert rejects it).
Each lone half is now normalized to U+FFFD up front — the same treatment
String.prototype.toWellFormed() applies — keeping the clip guarantee and
closing the no-cut path in one move.
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>1 parent 6f972ad commit cc75830
2 files changed
Lines changed: 36 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
7 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
8 | 17 | | |
9 | | - | |
10 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
11 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
0 commit comments