diff options
Diffstat (limited to 'src/printf.c')
-rw-r--r-- | src/printf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c index fd42bd2bc..4505a5675 100644 --- a/src/printf.c +++ b/src/printf.c @@ -195,6 +195,13 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){ #define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */ /* +** Hard limit on the precision of floating-point conversions. +*/ +#ifndef SQLITE_PRINTF_PRECISION_LIMIT +# define SQLITE_FP_PRECISION_LIMIT 100000000 +#endif + +/* ** Render a string given by "fmt" into the StrAccum object. */ void sqlite3_str_vappendf( @@ -515,6 +522,11 @@ void sqlite3_str_vappendf( length = 0; #else if( precision<0 ) precision = 6; /* Set default precision */ +#ifdef SQLITE_FP_PRECISION_LIMIT + if( precision>SQLITE_FP_PRECISION_LIMIT ){ + precision = SQLITE_FP_PRECISION_LIMIT; + } +#endif if( realvalue<0.0 ){ realvalue = -realvalue; prefix = '-'; |