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

Some more cases of CORE-5112 as pointed by Dmitry Yemanov

This commit is contained in:
aafemt 2016-02-23 16:18:38 +00:00
parent 2461d05460
commit 7a7c6cb95b
11 changed files with 51 additions and 33 deletions

View File

@ -1758,6 +1758,8 @@ C --
PARAMETER (GDS__dsql_no_input_sqlda = 336003109)
INTEGER*4 GDS__dsql_no_output_sqlda
PARAMETER (GDS__dsql_no_output_sqlda = 336003110)
INTEGER*4 GDS__dsql_wrong_param_num
PARAMETER (GDS__dsql_wrong_param_num = 336003111)
INTEGER*4 GDS__dyn_filter_not_found
PARAMETER (GDS__dyn_filter_not_found = 336068645)
INTEGER*4 GDS__dyn_func_not_found

View File

@ -1753,6 +1753,8 @@ const
gds_dsql_no_input_sqlda = 336003109;
isc_dsql_no_output_sqlda = 336003110;
gds_dsql_no_output_sqlda = 336003110;
isc_dsql_wrong_param_num = 336003111;
gds_dsql_wrong_param_num = 336003111;
isc_dyn_filter_not_found = 336068645;
gds_dyn_filter_not_found = 336068645;
isc_dyn_func_not_found = 336068649;

View File

@ -997,17 +997,23 @@ static void map_in_out(thread_db* tdbb, dsql_req* request, bool toExternal, cons
// Sanity check
if (count && !(toExternal ? dsql_msg_buf : in_dsql_msg_buf))
if (count)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err)
#ifdef DEV_BUILD
<< Arg::Gds(isc_random) << "Missing message data buffer"
#endif
);
if (toExternal)
{
if (dsql_msg_buf == NULL)
{
ERRD_post(Arg::Gds(isc_dsql_no_output_sqlda));
}
}
else
if (in_dsql_msg_buf == NULL)
{
ERRD_post(Arg::Gds(isc_dsql_no_input_sqlda));
}
}
bool err = false;
USHORT count2 = 0;
for (FB_SIZE_T i = 0; i < message->msg_parameters.getCount(); ++i)
{
@ -1022,11 +1028,18 @@ static void map_in_out(thread_db* tdbb, dsql_req* request, bool toExternal, cons
desc.clear();
//ULONG length = (IPTR) desc.dsc_address + desc.dsc_length;
if (/*length > msg_length || */!desc.dsc_dtype)
//if (length > msg_length)
//{
// ERRD_post(Arg::Gds(isc_dsql_sqlda_err)
// << Arg::Gds(isc_random) << "Message buffer too short"
// );
//}
if (!desc.dsc_dtype)
{
err = true;
break;
ERRD_post(Arg::Gds(isc_dsql_sqlda_err)
<< Arg::Gds(isc_dsql_datatype_err)
<< Arg::Gds(isc_dsql_sqlvar_index) << Arg::Num(parameter->par_index-1)
);
}
UCHAR* msgBuffer = request->req_msg_buffers[parameter->par_message->msg_buffer_number];
@ -1045,8 +1058,9 @@ static void map_in_out(thread_db* tdbb, dsql_req* request, bool toExternal, cons
length = null_offset + sizeof(SSHORT);
if (length > msg_length)
{
err = true;
break;
ERRD_post(Arg::Gds(isc_dsql_sqlda_err)
<< Arg::Gds(isc_random) << "Message buffer too short"
);
}
*/
@ -1089,20 +1103,14 @@ static void map_in_out(thread_db* tdbb, dsql_req* request, bool toExternal, cons
else
memset(parDesc.dsc_address, 0, parDesc.dsc_length);
count--;
++count2;
}
}
// If we got here because the loop was exited early or if part of the
// message given to us hasn't been used, complain.
if (err || count)
if (count != count2)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err)
#ifdef DEV_BUILD
<< Arg::Gds(isc_random) << (err ? "Message buffer too short" : "Wrong number of message parameters")
#endif
ERRD_post(Arg::Gds(isc_dsql_sqlda_err) <<
Arg::Gds(isc_dsql_wrong_param_num) << Arg::Num(count) <<Arg::Num(count2)
);
}
@ -1210,13 +1218,11 @@ static USHORT parse_metadata(dsql_req* request, IMessageMetadata* meta,
unsigned count = meta->getCount(&st);
checkD(&st);
if (count != parameters.getCount())
unsigned count2 = parameters.getCount();
if (count != count2)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
Arg::Gds(isc_dsql_sqlda_err)
#ifdef DEV_BUILD
<< Arg::Gds(isc_random) << "Wrong number of message parameters"
#endif
ERRD_post(Arg::Gds(isc_dsql_sqlda_err) <<
Arg::Gds(isc_dsql_wrong_param_num) <<Arg::Num(count2) << Arg::Num(count)
);
}

View File

@ -875,6 +875,7 @@ static const struct {
{"dsql_no_sqldata", 336003108},
{"dsql_no_input_sqlda", 336003109},
{"dsql_no_output_sqlda", 336003110},
{"dsql_wrong_param_num", 336003111},
{"dyn_filter_not_found", 336068645},
{"dyn_func_not_found", 336068649},
{"dyn_index_not_found", 336068656},

View File

@ -909,6 +909,7 @@ const ISC_STATUS isc_dsql_no_sqlind = 336003107L;
const ISC_STATUS isc_dsql_no_sqldata = 336003108L;
const ISC_STATUS isc_dsql_no_input_sqlda = 336003109L;
const ISC_STATUS isc_dsql_no_output_sqlda = 336003110L;
const ISC_STATUS isc_dsql_wrong_param_num = 336003111L;
const ISC_STATUS isc_dyn_filter_not_found = 336068645L;
const ISC_STATUS isc_dyn_func_not_found = 336068649L;
const ISC_STATUS isc_dyn_index_not_found = 336068656L;
@ -1314,7 +1315,7 @@ const ISC_STATUS isc_trace_switch_user_only = 337182757L;
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
const ISC_STATUS isc_err_max = 1258;
const ISC_STATUS isc_err_max = 1259;
#else /* c definitions */
@ -2193,6 +2194,7 @@ const ISC_STATUS isc_err_max = 1258;
#define isc_dsql_no_sqldata 336003108L
#define isc_dsql_no_input_sqlda 336003109L
#define isc_dsql_no_output_sqlda 336003110L
#define isc_dsql_wrong_param_num 336003111L
#define isc_dyn_filter_not_found 336068645L
#define isc_dyn_func_not_found 336068649L
#define isc_dyn_index_not_found 336068656L
@ -2598,7 +2600,7 @@ const ISC_STATUS isc_err_max = 1258;
#define isc_trace_switch_param_miss 337182758L
#define isc_trace_param_act_notcompat 337182759L
#define isc_trace_mandatory_switch_miss 337182760L
#define isc_err_max 1258
#define isc_err_max 1259
#endif

View File

@ -878,6 +878,7 @@ Data source : @4"}, /* eds_statement */
{336003108, "empty pointer to data"}, /* dsql_no_sqldata */
{336003109, "No SQLDA for input values provided"}, /* dsql_no_input_sqlda */
{336003110, "No SQLDA for output values provided"}, /* dsql_no_output_sqlda */
{336003111, "Wrong number of parameters (expected @1, got @2)"}, /* dsql_wrong_param_num */
{336068645, "BLOB Filter @1 not found"}, /* dyn_filter_not_found */
{336068649, "Function @1 not found"}, /* dyn_func_not_found */
{336068656, "Index not found"}, /* dyn_index_not_found */

View File

@ -874,6 +874,7 @@ static const struct {
{336003108, -802}, /* 36 dsql_no_sqldata */
{336003109, -802}, /* 37 dsql_no_input_sqlda */
{336003110, -802}, /* 38 dsql_no_output_sqlda */
{336003111, -313}, /* 39 dsql_wrong_param_num */
{336068645, -901}, /* 37 dyn_filter_not_found */
{336068649, -901}, /* 41 dyn_func_not_found */
{336068656, -901}, /* 48 dyn_index_not_found */

View File

@ -874,6 +874,7 @@ static const struct {
{336003108, "07002"}, // 36 dsql_no_sqldata
{336003109, "07002"}, // 37 dsql_no_input_sqlda
{336003110, "07002"}, // 38 dsql_no_output_sqlda
{336003111, "07001"}, // 39 dsql_wrong_param_num
{336068645, "42000"}, // 37 dyn_filter_not_found
{336068649, "42000"}, // 41 dyn_func_not_found
{336068656, "42000"}, // 48 dyn_index_not_found

View File

@ -5,7 +5,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
('2015-03-17 18:33:00', 'QLI', 1, 533)
('2015-01-07 18:01:51', 'GFIX', 3, 134)
('1996-11-07 13:39:40', 'GPRE', 4, 1)
('2016-02-15 00:48:00', 'DSQL', 7, 39)
('2016-02-23 00:00:00', 'DSQL', 7, 40)
('2015-10-07 12:30:00', 'DYN', 8, 291)
('1996-11-07 13:39:40', 'INSTALL', 10, 1)
('1996-11-07 13:38:41', 'TEST', 11, 4)

View File

@ -1681,6 +1681,7 @@ COMMIT WORK;
('dsql_no_sqldata', NULL, 'why.cpp', NULL, 7, 36, NULL, 'empty pointer to data', NULL, NULL);
('dsql_no_input_sqlda', NULL, NULL, NULL, 7, 37, NULL, 'No SQLDA for input values provided', NULL, NULL);
('dsql_no_output_sqlda', NULL, NULL, NULL, 7, 38, NULL, 'No SQLDA for output values provided', NULL, NULL);
('dsql_wrong_param_num', NULL, NULL, NULL, 7, 39, NULL, 'Wrong number of parameters (expected @1, got @2)', NULL, NULL);
-- Do not change the arguments of the previous DSQL messages.
-- Write the new DSQL messages here.
-- DYN

View File

@ -862,6 +862,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-802, '07', '002', 7, 36, 'dsql_no_sqldata', NULL, NULL)
(-802, '07', '002', 7, 37, 'dsql_no_input_sqlda', NULL, NULL)
(-802, '07', '002', 7, 38, 'dsql_no_output_sqlda', NULL, NULL)
(-313, '07', '001', 7, 39, 'dsql_wrong_param_num', NULL, NULL)
-- DYN
(-901, '42', '000', 8, 37, 'dyn_filter_not_found', NULL, NULL)
(-901, '42', '000', 8, 41, 'dyn_func_not_found', NULL, NULL)