SQLite

Check-in [eda84dcf]
Login

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

Overview
Comment:Add OOM check, per tip at forum post 933479b2d5
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: eda84dcffee6016fb3f8588d96c7ffb6275edd626b11f6fe12e81be90226c7d8
User & Date: larrybr 2023-01-14 19:27:40
Context
2023-01-14
19:53
Omit the long-disused FTS1 and FTS2 implements from the active source tree. The code will persist forever in the source repository, but there is no point in carrying it around in the latest tarballs where it is never used. (check-in: 2bb50d5a user: drh tags: trunk)
19:36
Add OOM check, per tip at forum post 933479b2d5 (Leaf check-in: c66c7734 user: drh tags: branch-3.40)
19:27
Add OOM check, per tip at forum post 933479b2d5 (check-in: eda84dcf user: larrybr tags: trunk)
19:09
Doc-only fix, per forum post 0cfaf6876b (check-in: eac135fd user: larrybr tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/sqlar.c.
87
88
89
90
91
92
93


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  sz = sqlite3_value_int(argv[1]);

  if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){
    sqlite3_result_value(context, argv[0]);
  }else{
    const Bytef *pData= sqlite3_value_blob(argv[0]);
    Bytef *pOut = sqlite3_malloc(sz);


    if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){
      sqlite3_result_error(context, "error in uncompress()", -1);
    }else{
      sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT);
    }
    sqlite3_free(pOut);
  }
}


#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_sqlar_init(
  sqlite3 *db, 
  char **pzErrMsg, 







>
>
|







<







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
  sz = sqlite3_value_int(argv[1]);

  if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){
    sqlite3_result_value(context, argv[0]);
  }else{
    const Bytef *pData= sqlite3_value_blob(argv[0]);
    Bytef *pOut = sqlite3_malloc(sz);
    if( pOut==0 ){
      sqlite3_result_error_nomem(context);
    }else if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){
      sqlite3_result_error(context, "error in uncompress()", -1);
    }else{
      sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT);
    }
    sqlite3_free(pOut);
  }
}


#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_sqlar_init(
  sqlite3 *db, 
  char **pzErrMsg,