You are not logged in.
Pages: 1
in TDynArrayHashed.HashAdd sometimes fHashsCount = 256, but Length(fHashs)=0,
with fHashs[-result-1] do begin // HashFind returned negative index in fHashs[]
Hash := aHashCode;
Index := n;
end;
this cause write fHashs[-result-1] will generate AV(here result=-1),
but not every time this occure, i have a function like this:
function test(const aParam: RawUTF8; aConnection: TSQLDBConnection): Boolean;
var
sql: RawUTF8;
rows, updateStatement: ISQLDBStatement;
begin
rows := aConnection.NewStatementPrepared(sql, true);
if not Assigned(rows) then exit;
rows.Bind([aParam]);
rows.ExecutePrepared;
....
end;
below is log, thanks
20160901 07132747 EXCOS EAccessViolation (C0000005) at 00516473 SynCommons.TDynArrayHashed.HashAdd (42926) stack trace API 0051662B SynCommons.TDynArrayHashed.FindHashedForAdding (42960) 00516689 SynCommons.TDynArrayHashed.AddAndMakeUniqueName (42971) 0055C758 SynOleDB.TOleDBStatement.BindColumns (2215) 0055BDBD SynOleDB.TOleDBStatement.FromRowSet (2024) 0055B89B SynOleDB.TOleDBStatement.ExecutePrepared (1989) 006BF93F
Offline
when reuse a cache statement
procedure TOleDBStatement.Reset;
begin
...
fColumn.Clear;
fColumn.ReHash;
...
end;
seems TDynArrayHashed.ReHash need add fHashsCount := 0
function TDynArrayHashed.ReHash(aHasher: TOnDynArrayHashOne=nil): boolean;
var i, n, cap, ndx: integer;
P: PAnsiChar;
aHashCode: cardinal;
begin
result := false;
fHashs := nil;
fHashsCount := 0; //add this to reset count
n := Count;
if (n=0) or (n<fHashCountTrigger) then
exit; // hash only if needed, and avoid GPF after TDynArray.Clear (Count=0)
Offline
Please check http://synopse.info/fossil/info/ddc1dc391a
Thanks for the feedback!
Offline
Pages: 1