You are not logged in.
Pages: 1
With certain long keys the following code throws AV
s := StringOfChar('x', 222);
dict := Collections.NewKeyValue<string,integer>;
dict.TryGetValue(s, v);
Debugging it it looks like that the HashSynUnicode code is missing a defererence here:
if l > 255 then // no need to hash too big a content
begin
Item := @PAnsiChar(Item)[l - 256]; // hash ending of string
l := 256;
end;
It should be PAnsiChar(Item^), the current code hashes the memory at an offset relative to the string reference, not the start of the string content (with strings longer than 127 chars).
Pages: 1