Dear developers and users,

I maybe noticed a bug in TXMLConfig on Windows CE.

I create the configuration component dynamically in code because of the 
initial access violation - to catch the error:

    if XMLC = nil then
      XMLC := TXMLConfig.Create(Self);
    XMLC.RootName := 'CONFIG';
    XMLC.Filename := 'Config.xml';

 From somewhere (not sure, WinCE debugging really takes a while when 
emulating...) I get to unit XMLRead, procedure 
TXMLStreamInputSource.FetchData, line 920:

  PWideChar(FCharBufEnd)^ := #0;

The whole procedure is:

procedure TXMLStreamInputSource.FetchData;
var
  Remainder, BytesRead: Integer;
  OldBuf: PChar;
begin
  Assert(FCharBufEnd - FCharBuf < Slack-4);

  OldBuf := FCharBuf;
  Remainder := FCharBufEnd - FCharBuf;
  if Remainder < 0 then
    Remainder := 0;
  FCharBuf := FAllocated+Slack-4-Remainder;
  Move(OldBuf^, FCharBuf^, Remainder);
  BytesRead := FStream.Read(FAllocated[Slack-4], FCapacity);
  FCharBufEnd := FAllocated + (Slack-4) + BytesRead;
  PWideChar(FCharBufEnd)^ := #0;
end;

I found a very similar bug on the top of the tracker. Maybe this also 
helps to locate the cause.

Lazarus 0.9.25 beta
2008-07-25
FPC 2.2.3
SVN rev. 15862

Pavel Řezníček
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to