1. Any call to FbException.catchException(nil, e) will raise Access Violation 
in catchException procedure.

function IUdrPluginImpl_getMasterDispatcher(this: IUdrPlugin): IMaster; cdecl;
begin
  try
    Result := IUdrPluginImpl(this).getMaster();
  except
    on e: Exception do FbException.catchException(nil, e); // There are 299 
such places in code (with first nil parameter).
  end
end;


class procedure FbException.catchException(status: IStatus; e: Exception);
var
  statusVector: array[0..4] of NativeIntPtr;
  msg: AnsiString;
begin
  if (e.inheritsFrom(FbException)) then
    status.setErrors(FbException(e).getStatus.getErrors)
  else
  begin
    msg := e.message;

    statusVector[0] := NativeIntPtr(isc_arg_gds);
    statusVector[1] := NativeIntPtr(isc_random);
    statusVector[2] := NativeIntPtr(isc_arg_string);
    statusVector[3] := NativeIntPtr(PAnsiChar(msg));
    statusVector[4] := NativeIntPtr(isc_arg_end);

    status.setErrors(@statusVector);
  end
end;


2. On "msg := e.message" all unicode characters will be lost:
- E.Message is utf-16 string for Delphi 2009 and higher
- E.Message is ansi string for Delphi 2007 and lower
- E.Message is compiler switches dependent for freepascal 3.0.0 and higher 
(default is utf-8)

3. Maybe we need to put a sample of firebird.pas at github. It will allow other 
developers to patch it in more productive way than now.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to