View Issue Details

IDProjectCategoryView StatusLast Update
0002854JEDI VCL00 JVCL Componentspublic2005-04-10 16:07
ReportertimschatAssigned Tooutchy 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0002854: Reading and Writing binary data from registry using TJvAppRegistryStorage causes AV
DescriptionThe issue is caused by a misunderstanding of pointer passing. The corrected code looks as follows:

function TJvAppRegistryStorage.DoReadBinary(const Path: string; Buf: Pointer; BufSize: Integer): Integer;
var
  SubKey: string;
  ValueName: string;
begin
  SplitKeyPath(Path, SubKey, ValueName);
  Result := RegReadBinary(FRegHKEY, SubKey, ValueName, Buf^, BufSize);
end;

procedure TJvAppRegistryStorage.DoWriteBinary(const Path: string; Buf: Pointer; BufSize: Integer);
var
  SubKey: string;
  ValueName: string;
begin
  SplitKeyPath(Path, SubKey, ValueName);
  CreateKey(SubKey);
  RegWriteBinary(FRegHKEY, SubKey, ValueName, Buf^, BufSize);
end;
TagsNo tags attached.

Activities

outchy

2005-04-10 13:13

administrator   ~0006881

This bug was introduced when the function's prototypes were changed.

outchy

2005-04-10 13:33

administrator   ~0006883

This bug caused no AV on my machine (addresses were still valid), but it was address to address which cause erratic behaviour (the code was writting the low order byte of the address, not the content pointed).
I didn't have any AV running my tests because the data size was below 4 bytes, there may be AV if the data size was above or equal 4 bytes.

Bug fixed in the CVS.

anonymous

2005-04-10 13:59

viewer   ~0006884

Jep, actually I think everything >4 bytes messes up the stack. But good to hear its fixed :)

Issue History

Date Modified Username Field Change
2005-04-09 17:46 timschat New Issue
2005-04-10 13:13 outchy Note Added: 0006881
2005-04-10 13:13 outchy Status new => confirmed
2005-04-10 13:33 outchy Note Added: 0006883
2005-04-10 13:59 anonymous Note Added: 0006884
2005-04-10 16:07 outchy Status confirmed => resolved
2005-04-10 16:07 outchy Resolution open => fixed
2005-04-10 16:07 outchy Assigned To => outchy