Alter function result type and run query can cause server to crash ------------------------------------------------------------------
Key: CORE-5849 URL: http://tracker.firebirdsql.org/browse/CORE-5849 Project: Firebird Core Issue Type: Bug Components: Engine Affects Versions: 3.0.4 Environment: WI-V3.0.4.32954 Firebird 3.0 Reporter: Karol Bieniaszewski Priority: Critical SET TERM ^ ; CREATE FUNCTION FUN2(A CHAR(8), B CHAR(4), C CHAR(12)) RETURNS CHAR(2) AS DECLARE VARIABLE VAR_RESULT VARCHAR(50); BEGIN VAR_RESULT = A || B || C; IF (char_length(VAR_RESULT)=20) then VAR_RESULT = '21312321'; RETURN VAR_RESULT; END^ SET TERM ; ^ SET TERM ^ ; CREATE FUNCTION FUN1(A CHAR(8), B CHAR(4), C CHAR(12)) RETURNS CHAR(26) AS BEGIN RETURN FUN2(A, B, C) || A || B || C; END^ SET TERM ; ^ ------------------------------------------------------------------------------------------ run the query: SELECT FUN1('1020', '2080', '000625180347'), FUN2('1020', '2080', '000625180347') FROM RDB$DATABASE commit; ------------------------------------------------------------------------------------------ alter result type SET TERM ^ ; ALTER FUNCTION FUN2(A CHAR(8), B CHAR(4), C CHAR(12)) RETURNS CHAR(50) AS DECLARE VARIABLE VAR_RESULT VARCHAR(50); BEGIN VAR_RESULT = A || B || C; IF (char_length(VAR_RESULT)=20) then VAR_RESULT = '21312321'; RETURN VAR_RESULT; END^ SET TERM ; ^ ------------------------------------------------------------------------------------------ run the query: SELECT FUN1('1020', '2080', '000625180347'), FUN2('1020', '2080', '000625180347') FROM RDB$DATABASE ------------------------------------------------------------------------------------------ error reading data from the connection... FIREBIRDDEV Wed Jun 20 09:52:34 2018 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 ------------------------------------------------------------------------------ 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