From: <aa...@us...> - 2016-02-23 16:18:40
|
Revision: 63007 http://sourceforge.net/p/firebird/code/63007 Author: aafemt Date: 2016-02-23 16:18:38 +0000 (Tue, 23 Feb 2016) Log Message: ----------- Some more cases of CORE-5112 as pointed by Dmitry Yemanov Modified Paths: -------------- firebird/trunk/lang_helpers/gds_codes.ftn firebird/trunk/lang_helpers/gds_codes.pas firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/include/gen/codetext.h firebird/trunk/src/include/gen/iberror.h firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/include/gen/sql_code.h firebird/trunk/src/include/gen/sql_state.h firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/msgs/system_errors2.sql Modified: firebird/trunk/lang_helpers/gds_codes.ftn =================================================================== --- firebird/trunk/lang_helpers/gds_codes.ftn 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/lang_helpers/gds_codes.ftn 2016-02-23 16:18:38 UTC (rev 63007) @@ -1758,6 +1758,8 @@ 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 Modified: firebird/trunk/lang_helpers/gds_codes.pas =================================================================== --- firebird/trunk/lang_helpers/gds_codes.pas 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/lang_helpers/gds_codes.pas 2016-02-23 16:18:38 UTC (rev 63007) @@ -1753,6 +1753,8 @@ 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; Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/dsql/dsql.cpp 2016-02-23 16:18:38 UTC (rev 63007) @@ -997,17 +997,23 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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) ); } Modified: firebird/trunk/src/include/gen/codetext.h =================================================================== --- firebird/trunk/src/include/gen/codetext.h 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/include/gen/codetext.h 2016-02-23 16:18:38 UTC (rev 63007) @@ -875,6 +875,7 @@ {"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}, Modified: firebird/trunk/src/include/gen/iberror.h =================================================================== --- firebird/trunk/src/include/gen/iberror.h 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/include/gen/iberror.h 2016-02-23 16:18:38 UTC (rev 63007) @@ -909,6 +909,7 @@ 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_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 @@ #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 @@ #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 Modified: firebird/trunk/src/include/gen/msgs.h =================================================================== --- firebird/trunk/src/include/gen/msgs.h 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/include/gen/msgs.h 2016-02-23 16:18:38 UTC (rev 63007) @@ -878,6 +878,7 @@ {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 */ Modified: firebird/trunk/src/include/gen/sql_code.h =================================================================== --- firebird/trunk/src/include/gen/sql_code.h 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/include/gen/sql_code.h 2016-02-23 16:18:38 UTC (rev 63007) @@ -874,6 +874,7 @@ {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 */ Modified: firebird/trunk/src/include/gen/sql_state.h =================================================================== --- firebird/trunk/src/include/gen/sql_state.h 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/include/gen/sql_state.h 2016-02-23 16:18:38 UTC (rev 63007) @@ -874,6 +874,7 @@ {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 Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/msgs/facilities2.sql 2016-02-23 16:18:38 UTC (rev 63007) @@ -5,7 +5,7 @@ ('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) Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/msgs/messages2.sql 2016-02-23 16:18:38 UTC (rev 63007) @@ -1681,6 +1681,7 @@ ('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 Modified: firebird/trunk/src/msgs/system_errors2.sql =================================================================== --- firebird/trunk/src/msgs/system_errors2.sql 2016-02-23 13:38:04 UTC (rev 63006) +++ firebird/trunk/src/msgs/system_errors2.sql 2016-02-23 16:18:38 UTC (rev 63007) @@ -862,6 +862,7 @@ (-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) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |