Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 54591 Details for
Bug 86858
Serious SQLite 3.2.0 memory coruption when using ALTER TABLE .. ADD COLUMN
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to fix the ALTER memory coruption bug.
sqlite-3.2.0-alter_mem_coruption.patch (text/plain), 1.72 KB, created by
Dizzy
on 2005-03-27 05:22:34 UTC
(
hide
)
Description:
Patch to fix the ALTER memory coruption bug.
Filename:
MIME Type:
Creator:
Dizzy
Created:
2005-03-27 05:22:34 UTC
Size:
1.72 KB
patch
obsolete
>--- sqlite-3.2.0.orig/src/alter.c 2005/03/19 14:45:49 1.4 >+++ sqlite-3.2.0/src/alter.c 2005/03/27 01:56:31 1.5 >@@ -521,7 +521,9 @@ > if( !pNew ) goto exit_begin_add_column; > pParse->pNewTable = pNew; > pNew->nCol = pTab->nCol; >- nAlloc = ((pNew->nCol)/8)+8; >+ assert( pNew->nCol>0 ); >+ nAlloc = (((pNew->nCol-1)/8)*8)+8; >+ assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); > pNew->aCol = (Column *)sqliteMalloc(sizeof(Column)*nAlloc); > pNew->zName = sqliteStrDup(pTab->zName); > if( !pNew->aCol || !pNew->zName ){ >--- sqlite-3.2.0.orig/test/alter3.test 2005/03/17 12:33:14 1.3 >+++ sqlite-3.2.0/test/alter3.test 2005/03/27 01:56:31 1.4 >@@ -13,19 +13,19 @@ > # file format change that may be used in the future to implement > # "ALTER TABLE ... ADD COLUMN". > # >-# $Id: alter3.test,v 1.3 2005/03/17 12:33:14 drh Exp $ >+# $Id: alter3.test,v 1.4 2005/03/27 01:56:31 danielk1977 Exp $ > # > > set testdir [file dirname $argv0] > >+source $testdir/tester.tcl >+ > # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. > ifcapable !altertable { > finish_test > return > } > >-source $testdir/tester.tcl >- > # Test Organisation: > # ------------------ > # >@@ -336,4 +336,29 @@ > } {1} > } > >+# Ticket #1183 - Make sure adding columns to large tables does not cause >+# memory corruption (as was the case before this bug was fixed). >+do_test alter3-8.1 { >+ execsql { >+ CREATE TABLE t4(c1); >+ } >+} {} >+do_test alter3-8.2 { >+ set cols c1 >+ for {set i 2} {$i < 100} {incr i} { >+ execsql " >+ ALTER TABLE t4 ADD c$i >+ " >+ lappend cols c$i >+ } >+ set ::sql "CREATE TABLE t4([join $cols {, }])" >+ list >+} {} >+do_test alter3-8.2 { >+ execsql { >+ SELECT sql FROM sqlite_master WHERE name = 't4'; >+ } >+} [list $::sql] >+ > finish_test >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 86858
: 54591 |
54593