mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Correct blob-to-text rendering in some corner cases.
FossilOrigin-Name: 7822e0e59f9b611fe6289cc762b0aff61f9b87c3a82c60de110f447589a2c125
This commit is contained in:
@@ -3372,6 +3372,7 @@ static u32 jsonXlateBlobToText(
|
||||
u32 k = 2;
|
||||
sqlite3_uint64 u = 0;
|
||||
const char *zIn = (const char*)&pParse->aBlob[i+n];
|
||||
int bOverflow = 0;
|
||||
if( zIn[0]=='-' ){
|
||||
jsonAppendChar(pOut, '-');
|
||||
k++;
|
||||
@@ -3382,11 +3383,13 @@ static u32 jsonXlateBlobToText(
|
||||
if( !sqlite3Isxdigit(zIn[k]) ){
|
||||
pOut->eErr |= JSTRING_MALFORMED;
|
||||
break;
|
||||
}else if( (u>>60)!=0 ){
|
||||
bOverflow = 1;
|
||||
}else{
|
||||
u = u*16 + sqlite3HexToInt(zIn[k]);
|
||||
}
|
||||
}
|
||||
jsonPrintf(100,pOut,"%llu",u);
|
||||
jsonPrintf(100,pOut,bOverflow?"9.0e999":"%llu", u);
|
||||
break;
|
||||
}
|
||||
case JSONB_FLOAT5: { /* Float literal missing digits beside "." */
|
||||
@@ -3519,6 +3522,7 @@ static u32 jsonXlateBlobToText(
|
||||
j = jsonXlateBlobToText(pParse, j, pOut);
|
||||
jsonAppendChar(pOut, (x++ & 1) ? ',' : ':');
|
||||
}
|
||||
if( x & 1 ) pOut->eErr |= JSTRING_MALFORMED;
|
||||
if( sz>0 ) pOut->nUsed--;
|
||||
jsonAppendChar(pOut, '}');
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user