Fix CouchJS character replacement
This was a bad backport from an old bug. We accidentally backed up when
looking at the second half of a surrogate pair. Instead the backup
should only happen when we see a low half of a surrogate pair with no
preceding high half.
COUCHDB-3173
diff --git a/priv/couch_js/utf8.c b/priv/couch_js/utf8.c
index fcafff6..4cdb9c2 100644
--- a/priv/couch_js/utf8.c
+++ b/priv/couch_js/utf8.c
@@ -83,10 +83,10 @@
{
// Invalid second half of surrogate pair
v = (uint32) 0xFFFD;
+ // Undo our character advancement
+ src--;
+ srclen++;
}
- // Undo our character advancement
- src--;
- srclen++;
}
else
{