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

Avoid the possibility of signed integer overflow with oversized precisions

in %d conversions in the printf() implementation.

FossilOrigin-Name: ef3a7c877a7549b351aafd983cfa96c863eb2641b6218bdd5cb563f659f879d8
This commit is contained in:
drh
2017-03-20 16:34:18 +00:00
parent 5b3a3b359a
commit 5f42995a0a
3 changed files with 11 additions and 10 deletions

View File

@@ -400,12 +400,13 @@ void sqlite3VXPrintf(
nOut = etBUFSIZE;
zOut = buf;
}else{
nOut = precision + 10 + precision/3;
zOut = zExtra = sqlite3Malloc( nOut );
u64 n = (u64)precision + 10 + precision/3;
zOut = zExtra = sqlite3Malloc( n );
if( zOut==0 ){
setStrAccumError(pAccum, STRACCUM_NOMEM);
return;
}
nOut = (int)n;
}
bufpt = &zOut[nOut-1];
if( xtype==etORDINAL ){