Skip to content

Commit 9ecfe99

Browse files
committed
Fix: Stop splitting surrogate-pairs in diff-match-patch deltas
See google/diff-match-patch#80 There have been certain cases where consecutive surrogate pairs crash `diff-match-patch` when it's building the _delta string_. This is because the diffing algorithm finds a common prefix up to and including half of the surrogate pair match when three consecutive code points share the same high surrogate. ``` // before - \ud83d\ude4b\ud83d\ue4b // after - \ud83d\ude4b\ud83d\ue4c\ud83d\ude4b // deltas - eq \ud83d\ude4b\ud83d -> add \ude4c -> eq \ud83d \ude4b ``` This crashes when trying to encode the invalid sequence of UTF-16 code units into `URIEncode`, which expects a valid Unicode string. After the fix the delta groups are normalized to prevent this situation and the `node-simperium` library should be able to process those problematic changesets.
1 parent e3822e2 commit 9ecfe99

File tree

4 files changed

+188
-120
lines changed

4 files changed

+188
-120
lines changed

RELEASE-NOTES.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.0.2
4+
5+
- Update diff-match-patch to fix problem when encoding consecutive surrogate pairs
6+
37
## 1.0.1
48

59
- Disconnect from existing socket connection when connecting [#90](https://github.com/Simperium/node-simperium/pull/90)

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simperium",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "A simperium client for node.js",
55
"main": "./lib/simperium/index.js",
66
"repository": {

0 commit comments

Comments
 (0)