Access violation on UDF crashes server
---------------------------------------
Key: CORE-5234
URL: http://tracker.firebirdsql.org/browse/CORE-5234
Project: Firebird Core
Issue Type: Bug
Components: UDF
Affects Versions: 3.0.0
Environment: Windows 7 x64 Professional, Firebird 3.0 x86
Reporter: Beto Neto
Priority: Blocker
I have a UDF named jjwudf. Inside it we have this exported function:
procedure udf_StrOfChr(Ret, Ch: PChar; var Count: integer); cdecl; export;
var
I: integer;
begin
if (Ch^ = #0) or (Count <= 0) then
Ret^ := #0
else begin
for I := 1 to Count do begin
Ret^ := Ch^;
Inc(Ret);
end;
Ret^ := #0;
end;
end;
And this is its DDL
DECLARE EXTERNAL FUNCTION UDF_STROFCHAR
CSTRING(254),
CSTRING(1),
INTEGER
RETURNS PARAMETER 1
ENTRY_POINT 'udf_StrOfChr' MODULE_NAME 'jjwudf';
It returns a string of the char repeated, see a usage example:
select udf_StrOfChr('a', 3) from rdb$database
Returns "aaa"
When I use it on 2.x Firebird Servers, it works! But on Firebird 3.0 it crashes
the server.
firebird.log
myvm Mon May 09 11:33:01 2016
The user defined function: UDF_STROFCHAR
referencing entrypoint: udf_StrOfChr
in module: jjwudf
caused the fatal exception: Access violation.
The code attempted to access a virtual
address without privilege to do so.
This exception will cause the Firebird server
to terminate abnormally.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel