Skip to content

Commit

Permalink
Fix: No more crashing/skipped changes for certain changes
Browse files Browse the repository at this point in the history
See: Simperium/node-simperium#91
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.

This patch updates the dependency on the patched version of
`node-simperium`.
  • Loading branch information
dmsnell committed Nov 13, 2019
1 parent a69721f commit d4184ac
Show file tree
Hide file tree
Showing 2 changed files with 1,620 additions and 3,176 deletions.
Loading

0 comments on commit d4184ac

Please sign in to comment.