enhanced awk to detected divide-by-zero error when folding constans
This commit is contained in:
parent
028646bb54
commit
1d99026dbc
@ -3364,6 +3364,12 @@ static int fold_constants_for_binop (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case QSE_AWK_BINOP_DIV:
|
case QSE_AWK_BINOP_DIV:
|
||||||
|
if (((qse_awk_nde_int_t*)right)->val == 0)
|
||||||
|
{
|
||||||
|
qse_awk_seterrnum (awk, QSE_AWK_EDIVBY0, QSE_NULL);
|
||||||
|
return QSE_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (INT_BINOP_INT(left,%,right))
|
if (INT_BINOP_INT(left,%,right))
|
||||||
{
|
{
|
||||||
folded->r = (qse_awk_flt_t)((qse_awk_nde_int_t*)left)->val /
|
folded->r = (qse_awk_flt_t)((qse_awk_nde_int_t*)left)->val /
|
||||||
@ -3371,8 +3377,17 @@ static int fold_constants_for_binop (
|
|||||||
fold = QSE_AWK_NDE_FLT;
|
fold = QSE_AWK_NDE_FLT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* fall through here */
|
|
||||||
|
folded->l = INT_BINOP_INT(left,/,right);
|
||||||
|
break;
|
||||||
|
|
||||||
case QSE_AWK_BINOP_IDIV:
|
case QSE_AWK_BINOP_IDIV:
|
||||||
|
if (((qse_awk_nde_int_t*)right)->val == 0)
|
||||||
|
{
|
||||||
|
qse_awk_seterrnum (awk, QSE_AWK_EDIVBY0, QSE_NULL);
|
||||||
|
return QSE_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
folded->l = INT_BINOP_INT(left,/,right);
|
folded->l = INT_BINOP_INT(left,/,right);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1174,11 +1174,14 @@ static int server_accept (
|
|||||||
* the same addresses. however, the port number may be different
|
* the same addresses. however, the port number may be different
|
||||||
* as a typical TPROXY rule is set to change the port number.
|
* as a typical TPROXY rule is set to change the port number.
|
||||||
* However, this check is fragile if the server port number is
|
* However, this check is fragile if the server port number is
|
||||||
* set to 0. */
|
* set to 0.
|
||||||
|
*
|
||||||
|
* Take note that if the TPROXY rule doesn't change the port
|
||||||
|
* number the above assumption gets wrong. so it won't be able
|
||||||
|
* to handle such a TPROXYed packet without port transformation. */
|
||||||
client->status |= QSE_HTTPD_CLIENT_INTERCEPTED;
|
client->status |= QSE_HTTPD_CLIENT_INTERCEPTED;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
/* TODO: how to set intercepted when TPROXY is used? */
|
|
||||||
else if ((client->initial_ifindex = resolve_ifindex (fd, client->local_addr)) <= -1)
|
else if ((client->initial_ifindex = resolve_ifindex (fd, client->local_addr)) <= -1)
|
||||||
{
|
{
|
||||||
/* the local_address is not one of a local address.
|
/* the local_address is not one of a local address.
|
||||||
|
Loading…
Reference in New Issue
Block a user