/ Check-in [1a247911]
Login

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

Overview
Comment:Add a missing memAboutToChange() macro to vdbe.c, the lack of which was causing an assert() to fail incorrectly. Problem found by libfuzzer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1a24791109da607d502ac41f179fe6c1dc46c774
User & Date: dan 2015-12-14 19:42:19
Context
2015-12-15
13:50
Add the SQLITE_OMIT_PARSER_TRACE compile-time option. check-in: 2fda43e6 user: drh tags: trunk
2015-12-14
19:42
Add a missing memAboutToChange() macro to vdbe.c, the lack of which was causing an assert() to fail incorrectly. Problem found by libfuzzer. check-in: 1a247911 user: dan tags: trunk
2015-12-11
14:59
Add a new assert() statement to the snapshot-specific part of sqlite3WalBeginReadTrans(). check-in: d8a12023 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

1977
1978
1979
1980
1981
1982
1983

1984
1985
1986
1987
1988
1989
1990
    }else{
      /* SQLITE_NULLEQ is clear and at least one operand is NULL,
      ** then the result is always NULL.
      ** The jump is taken if the SQLITE_JUMPIFNULL bit is set.
      */
      if( pOp->p5 & SQLITE_STOREP2 ){
        pOut = &aMem[pOp->p2];

        MemSetTypeFlag(pOut, MEM_Null);
        REGISTER_TRACE(pOp->p2, pOut);
      }else{
        VdbeBranchTaken(2,3);
        if( pOp->p5 & SQLITE_JUMPIFNULL ){
          goto jump_to_p2;
        }







>







1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
    }else{
      /* SQLITE_NULLEQ is clear and at least one operand is NULL,
      ** then the result is always NULL.
      ** The jump is taken if the SQLITE_JUMPIFNULL bit is set.
      */
      if( pOp->p5 & SQLITE_STOREP2 ){
        pOut = &aMem[pOp->p2];
        memAboutToChange(p, pOut);
        MemSetTypeFlag(pOut, MEM_Null);
        REGISTER_TRACE(pOp->p2, pOut);
      }else{
        VdbeBranchTaken(2,3);
        if( pOp->p5 & SQLITE_JUMPIFNULL ){
          goto jump_to_p2;
        }

Changes to test/with1.test.

970
971
972
973
974
975
976
977
















978
    WITH 
    x1 AS (SELECT 12),
    x2 AS (SELECT 13)
    SELECT * FROM x3
  )
  SELECT * FROM x4;
} {10 11}

















finish_test








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
    WITH 
    x1 AS (SELECT 12),
    x2 AS (SELECT 13)
    SELECT * FROM x3
  )
  SELECT * FROM x4;
} {10 11}

# Added to test a fix to a faulty assert() discovered by libFuzzer.
#
do_execsql_test 18.1 {
  WITH xyz(x) AS (VALUES(NULL) UNION SELECT round(1<x) FROM xyz ORDER BY 1)
  SELECT quote(x) FROM xyz;
} {NULL}
do_execsql_test 18.2 {
  WITH xyz(x) AS (
    SELECT printf('%d', 5) * NULL
    UNION SELECT round(1<1+x) 
    FROM xyz ORDER BY 1
  )
  SELECT 1 FROM xyz;
} 1


finish_test