8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

[FB4, GBAK] Correct handling of NULLs in RDB$RETURN_ARGUMENT and RDB$ARGUMENT_POSITION (#7870)

* [GBAK, restore] Initialization of RDB$RETURN_ARGUMENT and RDB$ARGUMENT_POSITION to NULL value

This is a fix for issue #7869 - potential problem of writing into database the uninitialized value in RDB$RETURN_ARGUMENT and RDB$ARGUMENT_POSITION columns.

get_function
 - inits X.RDB$RETURN_ARGUMENT.NULL
    - IF >=DB_VERSION_DDL12
    - ELSE

get_function_arg
 - inits X.RDB$ARGUMENT_POSITION.NULL
     - IF >=DB_VERSION_DDL12
     - IF >=DB_VERSION_DDL10
     - ELSE

* [GBAK, backup] Skip RDB$RETURN_ARGUMENT and RDB$ARGUMENT_POSITION with NULL value. Thanks to Adriano.

This is a fix for symmetric problem with RDB$RETURN_ARGUMENT and RDB$ARGUMENT_POSITION in backup.

write_functions
write_function_args
This commit is contained in:
Dmitry Kovalenko 2024-01-29 19:00:12 +03:00 committed by GitHub
parent 03153aacdc
commit 892d6bf8b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 5 deletions

View File

@ -2905,7 +2905,10 @@ void write_functions()
BURP_verbose (147, temp);
// msg 147 writing function %.*s
put_source_blob (att_function_description2, att_function_description, X.RDB$DESCRIPTION);
put_int32 (att_function_return_arg, X.RDB$RETURN_ARGUMENT);
if (!X.RDB$RETURN_ARGUMENT.NULL)
put_int32 (att_function_return_arg, X.RDB$RETURN_ARGUMENT);
put_int32 (att_function_type, X.RDB$FUNCTION_TYPE);
PUT_TEXT (att_function_query_name, X.RDB$QUERY_NAME);
@ -2959,7 +2962,10 @@ void write_functions()
put_source_blob (att_function_description2, att_function_description, X.RDB$DESCRIPTION);
PUT_TEXT (att_function_module_name, X.RDB$MODULE_NAME);
PUT_TEXT (att_function_entrypoint, X.RDB$ENTRYPOINT);
put_int32 (att_function_return_arg, X.RDB$RETURN_ARGUMENT);
if (!X.RDB$RETURN_ARGUMENT.NULL)
put_int32 (att_function_return_arg, X.RDB$RETURN_ARGUMENT);
put_int32 (att_function_type, X.RDB$FUNCTION_TYPE);
PUT_TEXT (att_function_query_name, X.RDB$QUERY_NAME);
put(tdgbl, att_end);
@ -3021,7 +3027,9 @@ void write_function_args(const GDS_NAME package, GDS_NAME funcptr)
BURP_verbose (141, temp);
// msg 141 writing argument for function %s
put_int32 (att_functionarg_position, X.RDB$ARGUMENT_POSITION);
if (!X.RDB$ARGUMENT_POSITION.NULL)
put_int32 (att_functionarg_position, X.RDB$ARGUMENT_POSITION);
put_int32 (att_functionarg_passing_mechanism, X.RDB$MECHANISM);
put_int32 (att_functionarg_field_type, X.RDB$FIELD_TYPE);
put_int32 (att_functionarg_field_scale, X.RDB$FIELD_SCALE);
@ -3072,7 +3080,10 @@ void write_function_args(const GDS_NAME package, GDS_NAME funcptr)
MISC_terminate (X.RDB$FUNCTION_NAME, temp, l, sizeof(temp));
BURP_verbose (141, temp);
// msg 141 writing argument for function %s
put_int32 (att_functionarg_position, X.RDB$ARGUMENT_POSITION);
if (!X.RDB$ARGUMENT_POSITION.NULL)
put_int32 (att_functionarg_position, X.RDB$ARGUMENT_POSITION);
put_int32 (att_functionarg_passing_mechanism, X.RDB$MECHANISM);
put_int32 (att_functionarg_field_type, X.RDB$FIELD_TYPE);
put_int32 (att_functionarg_field_scale, X.RDB$FIELD_SCALE);
@ -3100,7 +3111,10 @@ void write_function_args(const GDS_NAME package, GDS_NAME funcptr)
MISC_terminate (X.RDB$FUNCTION_NAME, temp, l, sizeof(temp));
BURP_verbose (141, temp);
// msg 141 writing argument for function %s
put_int32 (att_functionarg_position, X.RDB$ARGUMENT_POSITION);
if (!X.RDB$ARGUMENT_POSITION.NULL)
put_int32 (att_functionarg_position, X.RDB$ARGUMENT_POSITION);
put_int32 (att_functionarg_passing_mechanism, X.RDB$MECHANISM);
put_int32 (att_functionarg_field_type, X.RDB$FIELD_TYPE);
put_int32 (att_functionarg_field_scale, X.RDB$FIELD_SCALE);

View File

@ -5017,6 +5017,7 @@ bool get_function(BurpGlobals* tdgbl)
X.RDB$OWNER_NAME.NULL = TRUE;
X.RDB$MODULE_NAME.NULL = TRUE;
X.RDB$ENTRYPOINT.NULL = TRUE;
X.RDB$RETURN_ARGUMENT.NULL = TRUE;
X.RDB$SYSTEM_FLAG.NULL = FALSE;
X.RDB$SYSTEM_FLAG = 0;
@ -5073,6 +5074,7 @@ bool get_function(BurpGlobals* tdgbl)
break;
case att_function_return_arg:
X.RDB$RETURN_ARGUMENT.NULL = FALSE;
X.RDB$RETURN_ARGUMENT = (USHORT) get_int32(tdgbl);
break;
@ -5232,6 +5234,7 @@ bool get_function(BurpGlobals* tdgbl)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
X IN RDB$FUNCTIONS
X.RDB$RETURN_ARGUMENT.NULL = TRUE;
X.RDB$SYSTEM_FLAG = 0;
X.RDB$SYSTEM_FLAG.NULL = FALSE;
X.RDB$DESCRIPTION.NULL = TRUE;
@ -5267,6 +5270,7 @@ bool get_function(BurpGlobals* tdgbl)
break;
case att_function_return_arg:
X.RDB$RETURN_ARGUMENT.NULL = FALSE;
X.RDB$RETURN_ARGUMENT = (USHORT) get_int32(tdgbl);
break;
@ -5484,6 +5488,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
X IN RDB$FUNCTION_ARGUMENTS
X.RDB$ARGUMENT_POSITION.NULL = TRUE;
X.RDB$FIELD_SUB_TYPE.NULL = TRUE;
X.RDB$CHARACTER_SET_ID.NULL = TRUE;
X.RDB$FIELD_PRECISION.NULL = TRUE;
@ -5527,6 +5532,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
break;
case att_functionarg_position:
X.RDB$ARGUMENT_POSITION.NULL = FALSE;
X.RDB$ARGUMENT_POSITION = (USHORT) get_int32(tdgbl);
break;
@ -5694,6 +5700,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
X IN RDB$FUNCTION_ARGUMENTS
X.RDB$ARGUMENT_POSITION.NULL = TRUE;
X.RDB$FIELD_SUB_TYPE.NULL = TRUE;
X.RDB$CHARACTER_SET_ID.NULL = TRUE;
X.RDB$FIELD_PRECISION.NULL = TRUE;
@ -5711,6 +5718,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
break;
case att_functionarg_position:
X.RDB$ARGUMENT_POSITION.NULL = FALSE;
X.RDB$ARGUMENT_POSITION = (USHORT) get_int32(tdgbl);
break;
@ -5808,6 +5816,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
X IN RDB$FUNCTION_ARGUMENTS
X.RDB$ARGUMENT_POSITION.NULL = TRUE;
X.RDB$FIELD_SUB_TYPE.NULL = TRUE;
X.RDB$CHARACTER_SET_ID.NULL = TRUE;
@ -5824,6 +5833,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
break;
case att_functionarg_position:
X.RDB$ARGUMENT_POSITION.NULL = FALSE;
X.RDB$ARGUMENT_POSITION = (USHORT) get_int32(tdgbl);
break;