1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Bug fix in the randomjson.c extension.

FossilOrigin-Name: 1f3a33df530dbe330ea8b14a69369b807b413b25a167d1a3938f8f0faf97cc91
This commit is contained in:
drh
2023-12-18 13:51:54 +00:00
parent 2ae95649de
commit 52a4691fff
3 changed files with 10 additions and 12 deletions

View File

@ -138,11 +138,7 @@ static void jsonExpand(
char zBuf[200];
j = 0;
if( zSrc==0 ){
k = prngInt(p)%(count(azJsonTemplate)/2);
k = k*2 + eType;
zSrc = azJsonTemplate[k];
}
if( zSrc==0 ) zSrc = "%";
if( strlen(zSrc)>=STRSZ/10 ) r = 0;
for(i=0; zSrc[i]; i++){
if( zSrc[i]!='%' ){
@ -182,6 +178,8 @@ static void jsonExpand(
zX = strstr(zX, "DD");
}
}
assert( strstr(z, "XX")==0 );
assert( strstr(z, "DD")==0 );
if( j+n<STRSZ ){
memcpy(&zDest[j], z, n);
j += (int)n;