From: drh <> Date: Fri, 26 Jun 2026 13:41:07 +0000 (+0000) Subject: Fix unbounded whitespace skip in the decimal extension. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a54af99a1b5a7dad31d1112cdd847ff3d53c9f4;p=thirdparty%2Fsqlite.git Fix unbounded whitespace skip in the decimal extension. [bugs:/info/2026-06-26T10:06:54Z|Bugs 2026-06-26T10:06:54Z] FossilOrigin-Name: 71d4cfe5a34cf8485ab2e5abe670381cd068f013233d98c44355a6bcdfcbbbb0 --- diff --git a/ext/misc/decimal.c b/ext/misc/decimal.c index 478eb2f937..322fc427cf 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