1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Changes to avoid obscure, theoretical undefined behavior. This is preventative

measures only - no actual problems observed on tested compilers.

FossilOrigin-Name: a9e819082ba19e72db03bba37edfb7702ff489a5
This commit is contained in:
drh
2015-12-07 16:43:44 +00:00
parent 28a6a1168b
commit d797a9b5cb
6 changed files with 45 additions and 42 deletions

View File

@@ -788,7 +788,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
}
if( zNew ){
assert( p->zText!=0 || p->nChar==0 );
if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
if( p->zText==p->zBase && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
p->zText = zNew;
p->nAlloc = sqlite3DbMallocSize(p->db, zNew);
}else{