Am 2015-08-13 um 13:29 schrieb Michael Van Canneyt:


On Thu, 13 Aug 2015, Jürgen Hestermann wrote:

Am 2015-08-13 um 12:59 schrieb Michael Van Canneyt:


On Thu, 13 Aug 2015, Jürgen Hestermann wrote:

Determining the character length of a invalid UTF-8 string is quite useless.

Because it's not about getting a correct result then, but about not crashing 
due to invalid memory access.

But invalid memory access takes place anyway (within UTF8CharacterLength).

Why do you say so ? Unless you give a really bogus pointer, one of p[0] till 
p[3] is guaranteed to have #0 in it.
In such a case, no scan of the next byte is done ?

Sorry, I missinterpreted the code.
You are right.
I now see that the zero byte would stop any futher access to bytes after it.




--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to