mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:40:38 +01:00
Removed compile-time upper bound checks.
Limited the SUBSTRING result by 32k characters.
This commit is contained in:
parent
e6899db2a7
commit
87c1305c03
@ -1796,8 +1796,6 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
|
||||
}
|
||||
else
|
||||
{
|
||||
const USHORT extra_bytes =
|
||||
(desc->dsc_dtype == dtype_varying) ? sizeof(USHORT) : 0;
|
||||
if (offset_node->nod_type == nod_literal &&
|
||||
desc1.dsc_dtype == dtype_long)
|
||||
{
|
||||
@ -1809,7 +1807,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
|
||||
offset -= MOV_get_long(&desc3, 0);
|
||||
}
|
||||
// error() is a local routine in par.c, so we use plain ERR_post
|
||||
if (offset < 0 || offset > MAX_COLUMN_SIZE - extra_bytes)
|
||||
if (offset < 0)
|
||||
{
|
||||
ERR_post(isc_bad_substring_param,
|
||||
isc_arg_string, "offset", 0);
|
||||
@ -1820,7 +1818,7 @@ void CMP_get_desc(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node, DSC * de
|
||||
{
|
||||
const SLONG lenght = MOV_get_long(&desc2, 0);
|
||||
// error() is a local routine in par.c, so we use plain ERR_post
|
||||
if (lenght < 0 || lenght > MAX_COLUMN_SIZE - extra_bytes)
|
||||
if (lenght < 0)
|
||||
{
|
||||
ERR_post(isc_bad_substring_param,
|
||||
isc_arg_string, "length", 0);
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* $Id: evl.cpp,v 1.103 2004-08-21 09:29:45 robocop Exp $
|
||||
* $Id: evl.cpp,v 1.104 2004-09-22 07:36:55 dimitr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -4858,9 +4858,8 @@ static bool string_function(
|
||||
}
|
||||
|
||||
|
||||
static dsc* substring(
|
||||
thread_db* tdbb,
|
||||
impure_value* impure, dsc* value, SLONG offset_arg, SLONG length_arg)
|
||||
static dsc* substring(thread_db* tdbb, impure_value* impure,
|
||||
dsc* value, SLONG offset_arg, SLONG length_arg)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4877,11 +4876,11 @@ static dsc* substring(
|
||||
desc.dsc_dtype = dtype_text;
|
||||
desc.dsc_scale = 0;
|
||||
|
||||
if (offset_arg < 0 || offset_arg > MAX_USHORT)
|
||||
if (offset_arg < 0 || offset_arg > MAX_COLUMN_SIZE)
|
||||
{
|
||||
ERR_post(isc_bad_substring_param, isc_arg_string, "offset", 0);
|
||||
}
|
||||
else if (length_arg < 0 || length_arg > MAX_USHORT)
|
||||
else if (length_arg < 0 || length_arg > MAX_COLUMN_SIZE)
|
||||
{
|
||||
ERR_post(isc_bad_substring_param, isc_arg_string, "length", 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user