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

Add the SQLITE_PRINTF_PRECISION_LIMIT compile-time option.

FossilOrigin-Name: ecad75d69e0d5c83dd3584d363e557e84b65f7f2
This commit is contained in:
drh
2015-11-30 22:52:14 +00:00
parent 025d2f7ad8
commit c386ef4f2c
3 changed files with 21 additions and 7 deletions

View File

@@ -270,6 +270,12 @@ void sqlite3VXPrintf(
testcase( wx>0x7fffffff );
width = wx & 0x7fffffff;
}
assert( width>=0 );
#ifdef SQLITE_PRINTF_PRECISION_LIMIT
if( width>SQLITE_PRINTF_PRECISION_LIMIT ){
width = SQLITE_PRINTF_PRECISION_LIMIT;
}
#endif
/* Get the precision */
if( c=='.' ){
@@ -296,6 +302,14 @@ void sqlite3VXPrintf(
}else{
precision = -1;
}
assert( precision>=(-1) );
#ifdef SQLITE_PRINTF_PRECISION_LIMIT
if( precision>SQLITE_PRINTF_PRECISION_LIMIT ){
precision = SQLITE_PRINTF_PRECISION_LIMIT;
}
#endif
/* Get the conversion type modifier */
if( c=='l' ){
flag_long = 1;