SQLite

Check-in [de02a1d97a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure temporary Expr objects are fully initialized prior to sending them into sqlite3ExprCodeTemp().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | expr-simplify
Files: files | file ages | folders
SHA3-256: de02a1d97a860f780d9b75cddf008a8b1824cf0483f7891e6ed55b83e2d32d91
User & Date: drh 2018-09-19 11:59:15.245
Context
2018-09-19
14:54
Reduce the size of Expr from 80 to 72 bytes moving the pRight field inside the "x" union. This is an incremental check-in that still has issues. (check-in: 147c61a6d4 user: drh tags: expr-simplify)
11:59
Make sure temporary Expr objects are fully initialized prior to sending them into sqlite3ExprCodeTemp(). (check-in: de02a1d97a user: drh tags: expr-simplify)
2018-09-18
21:35
In the Expr object, the Expr.eX field determines what value is stored in the Expr.x union. This mostly works, but there are issues identified by valgrind. (check-in: 8849a463d6 user: drh tags: expr-simplify)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
3596
3597
3598
3599
3600
3601
3602

3603
3604
3605
3606
3607
3608
3609
#ifndef SQLITE_OMIT_FLOATING_POINT
      }else if( pLeft->op==TK_FLOAT ){
        assert( !ExprHasProperty(pExpr, EP_IntValue) );
        codeReal(v, pLeft->u.zToken, 1, target);
        return target;
#endif
      }else{

        tempX.op = TK_INTEGER;
        tempX.flags = EP_IntValue|EP_TokenOnly;
        tempX.u.iValue = 0;
        r1 = sqlite3ExprCodeTemp(pParse, &tempX, &regFree1);
        r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);
        sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);
        testcase( regFree2==0 );







>







3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
#ifndef SQLITE_OMIT_FLOATING_POINT
      }else if( pLeft->op==TK_FLOAT ){
        assert( !ExprHasProperty(pExpr, EP_IntValue) );
        codeReal(v, pLeft->u.zToken, 1, target);
        return target;
#endif
      }else{
        memset(&tempX, 0, sizeof(tempX));
        tempX.op = TK_INTEGER;
        tempX.flags = EP_IntValue|EP_TokenOnly;
        tempX.u.iValue = 0;
        r1 = sqlite3ExprCodeTemp(pParse, &tempX, &regFree1);
        r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);
        sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);
        testcase( regFree2==0 );