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).
Offline
Should be fixed by
https://github.com/synopse/mORMot2/commit/e625f9224
I have added some dedicated tests in
https://github.com/synopse/mORMot2/commit/d2ee299a7
Thanks a lot for the report and investigation!
Offline
Pages: 1