On Tue Nov 1 14:57:41 2022 +0000, Nikolay Sivov wrote:
What happens if you pass two surrogate halves to WriteString/WriteChars/WriteRawChars? Or even something like WriteChars(0xab, 1). It's possible they all share same hex escaping, and WriteSurrogateCharEntity() is not unique in that. Also, checking explicitly ranges here could as well be misplaced. I suspect WriteString() could validate that as well.
I'm not sure what you mean by this part. I mean, yes, WriteString/WriteChars/WriteRawChars all reject surrogate characters, whether passed in as one or as a pair. They all do so with WR_E_INVALIDSURROGATEPAIR so yes something needs to be done there. WriteChars(0xab, 1) will fail because WriteChars expects a string and so do the other relatives. I fail to understand the part about hex escaping because it doesn't look to me like these functions ever get to see the hex passed in the user, they only see Unicode characters...