[Lazarus] *** GMX Spamverdacht *** Re: Improving UTF8CharacterLength?

Michael Van Canneyt michael at freepascal.org
Thu Aug 13 13:29:34 CEST 2015



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 ?

Michael.


More information about the Lazarus mailing list