From a42e91477acffca178d648de6a326e001da56ff1 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 12 Sep 2008 13:37:47 +0000 Subject: [PATCH] Bug 439206. Make sure to not skip over the next char after the high surrogate when we have a missing low surrogate. r+sr=jst git-svn-id: svn://10.0.0.236/trunk@254180 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/ds/nsCRT.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mozilla/xpcom/ds/nsCRT.cpp b/mozilla/xpcom/ds/nsCRT.cpp index 35ce6c820a7..62b1c459538 100644 --- a/mozilla/xpcom/ds/nsCRT.cpp +++ b/mozilla/xpcom/ds/nsCRT.cpp @@ -306,6 +306,14 @@ PRUint32 nsCRT::HashCodeAsUTF8(const PRUnichar* start, PRUint32 length) code_length = 3; NS_WARNING("High surrogate not followed by low surrogate"); + + // The pointer to the next character points to the second 16-bit + // value, not beyond it, as per Unicode 5.0.0 Chapter 3 C10, only + // the first code unit of an illegal sequence must be treated as + // an illegally terminated code unit sequence (also Chapter 3 + // D91, "isolated [not paired and ill-formed] UTF-16 code units + // in the range D800..DFFF are ill-formed"). + --s; } W1 = 0;