SQLite

Check-in [cb70ee67ea]
Login

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

Overview
Comment:Make sure the source of a PULL opcode is not an ephemeral string. Ticket #360. (CVS 1031)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cb70ee67ea9f5a47d58820e0e8b28c8f945217ed
User & Date: drh 2003-06-22 01:41:49.000
Context
2003-06-23
11:06
Remove all references to SQLITE_OMIT_TRACE. Tracing is always enabled. Ticket #361. (CVS 1032) (check-in: ec31a5292c user: drh tags: trunk)
2003-06-22
01:41
Make sure the source of a PULL opcode is not an ephemeral string. Ticket #360. (CVS 1031) (check-in: cb70ee67ea user: drh tags: trunk)
2003-06-17
02:57
Remove unused variable. Ticket #355. (CVS 1030) (check-in: 5228cecdb8 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbe.c.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.228 2003/06/15 23:42:24 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** The makefile scans this source file and creates the following







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.229 2003/06/22 01:41:49 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** The makefile scans this source file and creates the following
975
976
977
978
979
980
981

982
983
984
985
986
987
988
  char **pzStack = &p->zStack[i];
  char *z;
  assert( (pStack->flags & STK_Ephem)!=0 );
  z = sqliteMallocRaw( pStack->n );
  if( z==0 ) return 1;
  memcpy(z, *pzStack, pStack->n);
  *pzStack = z;

  return 0;
}

/*
** Release the memory associated with the given stack level
*/
#define Release(P,I)  if((P)->aStack[I].flags&STK_Dyn){ hardRelease(P,I); }







>







975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
  char **pzStack = &p->zStack[i];
  char *z;
  assert( (pStack->flags & STK_Ephem)!=0 );
  z = sqliteMallocRaw( pStack->n );
  if( z==0 ) return 1;
  memcpy(z, *pzStack, pStack->n);
  *pzStack = z;
  pStack->flags &= !STK_Ephem;
  return 0;
}

/*
** Release the memory associated with the given stack level
*/
#define Release(P,I)  if((P)->aStack[I].flags&STK_Dyn){ hardRelease(P,I); }
1831
1832
1833
1834
1835
1836
1837

1838
1839
1840
1841
1842
1843
1844
case OP_Pull: {
  int from = p->tos - pOp->p1;
  int to = p->tos;
  int i;
  Stack ts;
  char *tz;
  VERIFY( if( from<0 ) goto not_enough_stack; )

  ts = aStack[from];
  tz = zStack[from];
  Deephemeralize(p, to);
  for(i=from; i<to; i++){
    Deephemeralize(p, i);
    aStack[i] = aStack[i+1];
    assert( (aStack[i].flags & STK_Ephem)==0 );







>







1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
case OP_Pull: {
  int from = p->tos - pOp->p1;
  int to = p->tos;
  int i;
  Stack ts;
  char *tz;
  VERIFY( if( from<0 ) goto not_enough_stack; )
  Deephemeralize(p, from);
  ts = aStack[from];
  tz = zStack[from];
  Deephemeralize(p, to);
  for(i=from; i<to; i++){
    Deephemeralize(p, i);
    aStack[i] = aStack[i+1];
    assert( (aStack[i].flags & STK_Ephem)==0 );
Added test/misc2.test.
































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 2003 June 21
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.1 2003/06/22 01:41:50 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Test for ticket #360
#
do_test misc2-1.1 {
  catchsql {
    CREATE TABLE FOO(bar integer);
    CREATE TRIGGER foo_insert BEFORE INSERT ON foo BEGIN
      SELECT CASE WHEN (NOT new.bar BETWEEN 0 AND 20)
             THEN raise(rollback, 'aiieee') END;
    END;
    INSERT INTO foo(bar) VALUES (1);
  }
} {1 aiieee}