/ Check-in [ffe75736]
Login

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

Overview
Comment:Avoid a NULL pointer deference when processing the IS operator if the right-hand side is an illegal "#ID" style variable. Fix for ticket [8c32a33a53092c85a15b]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ffe7573636c8057614b02f0a85559e1857fd04e4
User & Date: drh 2014-10-02 21:52:35
Context
2014-10-03
14:54
Update to requirements marks related to changes in the memory allocation interface and enhancement of the documentation regarding DEFAULT clauses in CREATE TABLE. check-in: 440705b9 user: drh tags: trunk
2014-10-02
21:52
Avoid a NULL pointer deference when processing the IS operator if the right-hand side is an illegal "#ID" style variable. Fix for ticket [8c32a33a53092c85a15b] check-in: ffe75736 user: drh tags: trunk
2014-10-01
13:17
Show the TK_DOT operator in the TreeView debugging output. No changes to production code. check-in: 07c89940 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

   957    957   expr(A) ::= expr(X) NOT NULL(E). {spanUnaryPostfix(&A,pParse,TK_NOTNULL,&X,&E);}
   958    958   
   959    959   %include {
   960    960     /* A routine to convert a binary TK_IS or TK_ISNOT expression into a
   961    961     ** unary TK_ISNULL or TK_NOTNULL expression. */
   962    962     static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
   963    963       sqlite3 *db = pParse->db;
   964         -    if( db->mallocFailed==0 && pY->op==TK_NULL ){
          964  +    if( pY && pA && pY->op==TK_NULL ){
   965    965         pA->op = (u8)op;
   966    966         sqlite3ExprDelete(db, pA->pRight);
   967    967         pA->pRight = 0;
   968    968       }
   969    969     }
   970    970   }
   971    971   

Changes to test/expr.test.

   201    201   test_expr expr-1.124 {i1=NULL, i2=NULL} \
   202    202     {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no
   203    203   test_expr expr-1.125 {i1=6, i2=NULL} \
   204    204     {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes
   205    205   test_expr expr-1.126 {i1=8, i2=8} \
   206    206     {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no
   207    207   
          208  +do_catchsql_test expr-1.127 {
          209  +  SELECT 1 IS #1;
          210  +} {1 {near "#1": syntax error}}
          211  +
   208    212   ifcapable floatingpoint {if {[working_64bit_int]} {
   209    213     test_expr expr-1.200\
   210    214         {i1=9223372036854775806, i2=1} {i1+i2}      9223372036854775807
   211    215     test_realnum_expr expr-1.201\
   212    216         {i1=9223372036854775806, i2=2} {i1+i2}      9.22337203685478e+18
   213    217     test_realnum_expr expr-1.202\
   214    218         {i1=9223372036854775806, i2=100000} {i1+i2} 9.22337203685488e+18