Browse Source

fcl-db: base: mark ABookmark parameter of TDataset.GotoBookmark method as const.
In trunk TBookmark is of type array of bytes (TBytes), prior this it was Pointer (to memory block of BookmarkSize where is stored "bookmark data").
BufDatset uses GotoBookmark and passes address of bookmark, which is okay when TBookmark was pointer, but when it is dynamic array then on entry into method FPC_DYNARRAY_INCR_REF is called, where is accessed "array header" in unallocated memory, which leads to invalid pointer operation.
Making parameter as const will avoid invoking reference counting mechanism. Bug #23381. Discussed also in DB-Core ML.

git-svn-id: trunk@23665 -

lacak 12 years ago
parent
commit
42d11a1274
2 changed files with 2 additions and 2 deletions
  1. 1 1
      packages/fcl-db/src/base/dataset.inc
  2. 1 1
      packages/fcl-db/src/base/db.pas

+ 1 - 1
packages/fcl-db/src/base/dataset.inc

@@ -1843,7 +1843,7 @@ begin
   FFieldList.GetFieldNames(List);
 end;
 
-Procedure TDataset.GotoBookmark(ABookmark: TBookmark);
+Procedure TDataset.GotoBookmark(const ABookmark: TBookmark);
 
 
 begin

+ 1 - 1
packages/fcl-db/src/base/db.pas

@@ -1598,7 +1598,7 @@ type
     function GetCurrentRecord(Buffer: TRecordBuffer): Boolean; virtual;
     procedure GetFieldList(List: TList; const FieldNames: string);
     procedure GetFieldNames(List: TStrings);
-    procedure GotoBookmark(ABookmark: TBookmark);
+    procedure GotoBookmark(const ABookmark: TBookmark);
     procedure Insert;
     procedure InsertRecord(const Values: array of const);
     function IsEmpty: Boolean;