libCom: Fix buggy pointer dereference in postfix()
This commit is contained in:
@@ -336,6 +336,10 @@ LIBCOM_API long
|
||||
break;
|
||||
|
||||
case SEPERATOR:
|
||||
if (pstacktop == stack) {
|
||||
*perror = CALC_ERR_BAD_SEPERATOR;
|
||||
goto bad;
|
||||
}
|
||||
/* Move operators to the output until open paren */
|
||||
while (pstacktop->name[0] != '(') {
|
||||
if (pstacktop <= stack+1) {
|
||||
@@ -354,6 +358,10 @@ LIBCOM_API long
|
||||
break;
|
||||
|
||||
case CLOSE_PAREN:
|
||||
if (pstacktop == stack) {
|
||||
*perror = CALC_ERR_PAREN_NOT_OPEN;
|
||||
goto bad;
|
||||
}
|
||||
/* Move operators to the output until matching paren */
|
||||
while (pstacktop->name[0] != '(') {
|
||||
if (pstacktop <= stack+1) {
|
||||
|
||||
@@ -298,7 +298,7 @@ MAIN(epicsCalcTest)
|
||||
const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0,
|
||||
g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0;
|
||||
|
||||
testPlan(/*635*/633);
|
||||
testPlan(637-2);
|
||||
|
||||
/* LITERAL_OPERAND elements */
|
||||
testExpr(0);
|
||||
@@ -953,6 +953,8 @@ MAIN(epicsCalcTest)
|
||||
// testBadExpr("1?", CALC_ERR_CONDITIONAL);
|
||||
// testBadExpr("1?1", CALC_ERR_CONDITIONAL);
|
||||
testBadExpr(":1", CALC_ERR_SYNTAX);
|
||||
testBadExpr("0,", CALC_ERR_BAD_SEPERATOR);
|
||||
testBadExpr("0)", CALC_ERR_PAREN_NOT_OPEN);
|
||||
|
||||
// Bit manipulations wrt bit 31 (bug lp:1514520)
|
||||
// using integer literals
|
||||
|
||||
Reference in New Issue
Block a user