/ Check-in [b5409849]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix OOM error reporting in the json1_group_object() SQL function. Remove an unreachable branch from the JSON1 logic.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b54098491531cd26ed461275ef4aae3d3ec9065e
User & Date: drh 2016-11-07 18:18:08
Context
2016-11-23
20:31
Fix OOM error reporting in the json1_group_object() SQL function. Remove an unreachable branch from the JSON1 logic. check-in: 6492e57e user: drh tags: branch-3.15
2016-11-08
00:30
Tweaks to speedtest1.c to better reflect mobile usage based on findings in the "Pocket Data" paper by Kennedy, Ajay, Challen, and Ziarek. check-in: b5733cae user: drh tags: trunk
2016-11-07
18:18
Fix OOM error reporting in the json1_group_object() SQL function. Remove an unreachable branch from the JSON1 logic. check-in: b5409849 user: drh tags: trunk
15:15
Replace some unreachable branches from the JSON1 extension with assert(). check-in: 145cd13e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/json1.c.

  1658   1658   }
  1659   1659   static void jsonObjectFinal(sqlite3_context *ctx){
  1660   1660     JsonString *pStr;
  1661   1661     pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
  1662   1662     if( pStr ){
  1663   1663       jsonAppendChar(pStr, '}');
  1664   1664       if( pStr->bErr ){
  1665         -      if( pStr->bErr==0 ) sqlite3_result_error_nomem(ctx);
         1665  +      if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
  1666   1666         assert( pStr->bStatic );
  1667   1667       }else{
  1668   1668         sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
  1669   1669                             pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
  1670   1670         pStr->bStatic = 1;
  1671   1671       }
  1672   1672     }else{
................................................................................
  1936   1936           jsonEachComputePath(p, &x, p->sParse.aUp[p->i]);
  1937   1937           jsonResult(&x);
  1938   1938           break;
  1939   1939         }
  1940   1940         /* For json_each() path and root are the same so fall through
  1941   1941         ** into the root case */
  1942   1942       }
  1943         -    case JEACH_ROOT: {
         1943  +    default: {
  1944   1944         const char *zRoot = p->zRoot;
  1945         -       if( zRoot==0 ) zRoot = "$";
         1945  +      if( zRoot==0 ) zRoot = "$";
  1946   1946         sqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC);
  1947   1947         break;
  1948   1948       }
  1949   1949       case JEACH_JSON: {
  1950   1950         assert( i==JEACH_JSON );
  1951   1951         sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_STATIC);
  1952   1952         break;