fixed a length calculation bug in fnc_split()
This commit is contained in:
parent
daf7377403
commit
cfa140a925
@ -797,7 +797,7 @@ static int fnc_split (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi, int use_array)
|
||||
hawk_ooch_t* fs_free = HAWK_NULL;
|
||||
hawk_ooch_t* p;
|
||||
|
||||
hawk_oow_t str_left, org_len;
|
||||
hawk_oow_t org_len;
|
||||
hawk_tre_t* fs_rex = HAWK_NULL;
|
||||
hawk_tre_t* fs_rex_free = HAWK_NULL;
|
||||
|
||||
@ -887,8 +887,7 @@ static int fnc_split (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi, int use_array)
|
||||
if (HAWK_UNLIKELY(x <= -1)) goto oops;
|
||||
|
||||
/* fill the map with actual values */
|
||||
p = str.ptr; str_left = str.len; org_len = str.len;
|
||||
nflds = 0;
|
||||
p = str.ptr; org_len = str.len; nflds = 0;
|
||||
|
||||
while (p)
|
||||
{
|
||||
@ -954,9 +953,9 @@ static int fnc_split (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi, int use_array)
|
||||
}
|
||||
|
||||
if (byte_str)
|
||||
str.len = str_left - ((p - str.ptr) * HAWK_SIZEOF_OOCH_T);
|
||||
str.len = org_len - ((hawk_bch_t*)p - (hawk_bch_t*)str.ptr);
|
||||
else
|
||||
str.len = str_left - (p - str.ptr);
|
||||
str.len = org_len - (p - str.ptr);
|
||||
}
|
||||
|
||||
if (do_fld) hawk_rtx_freemem (rtx, str.ptr);
|
||||
|
@ -2063,7 +2063,6 @@ static int run_pblock (hawk_rtx_t* rtx, hawk_chain_t* cha, hawk_oow_t bno)
|
||||
static HAWK_INLINE int run_block0 (hawk_rtx_t* rtx, hawk_nde_blk_t* nde)
|
||||
{
|
||||
hawk_nde_t* p;
|
||||
hawk_oow_t nlcls;
|
||||
hawk_oow_t saved_stack_top;
|
||||
int n = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user