From: drh <> Date: Fri, 26 Jun 2026 13:52:02 +0000 (+0000) Subject: Fix unbounded whitespace skip in the decimal extension. X-Git-Tag: release~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=842e4e5f2050e06da1bd4acae1f073701b60fb21;p=thirdparty%2Fsqlite.git Fix unbounded whitespace skip in the decimal extension. FossilOrigin-Name: 9a1729a4840e8640770d557657742355f2723f2dda05efeaaf6641af730c34b8 --- diff --git a/ext/misc/decimal.c b/ext/misc/decimal.c index a2fab71e49..0d18d00789 100644 --- a/ext/misc/decimal.c +++ b/ext/misc/decimal.c @@ -67,6 +67,9 @@ static void decimal_free(Decimal *p){ /* ** Allocate a new Decimal object initialized to the text in zIn[]. ** Return NULL if any kind of error occurs. +** +** Note that zIn[] is not necessarily zero-terminated. Always +** respect the boundary imposed by the n argument. */ static Decimal *decimalNewFromText(const char *zIn, int n){ Decimal *p = 0; @@ -84,11 +87,11 @@ static Decimal *decimalNewFromText(const char *zIn, int n){ p->nFrac = 0; p->a = sqlite3_malloc64( n+1 ); if( p->a==0 ) goto new_from_text_failed; - for(i=0; IsSpace(zIn[i]); i++){} - if( zIn[i]=='-' ){ + for(i=0; isign = 1; i++; - }else if( zIn[i]=='+' ){ + }else if( i