SQLite

Check-in [e4de5777]
Login

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

Overview
Comment:In the zipfile extension (which is not part of the SQLite amalgamation, but which is included in the CLI by default) ensure that fopen() is not invoked using a NULL filename. Fix for the issue reported by forum post d1c96a9032e564f8.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.40
Files: files | file ages | folders
SHA3-256: e4de5777578d27aede463c1e2c2437249e3ab7194401266473587572e0f203a5
User & Date: drh 2023-01-05 01:29:59
Original Comment: In the zipvfile extension (which is not part of the SQLite amalgamation, but which is included in the CLI by default) ensure that fopen() is not invoked using a NULL filename. Fix for the issue reported by forum post d1c96a9032e564f8.
Context
2023-01-05
01:32
Increase the version number to 3.40.2. (check-in: 43375ef8 user: drh tags: branch-3.40)
01:29
In the zipfile extension (which is not part of the SQLite amalgamation, but which is included in the CLI by default) ensure that fopen() is not invoked using a NULL filename. Fix for the issue reported by forum post d1c96a9032e564f8. (check-in: e4de5777 user: drh tags: branch-3.40)
01:26
In the zipfile extension (which is not part of the SQLite amalgamation, but which is included in the CLI by default) ensure that fopen() is not invoked using a NULL filename. Fix for the issue reported by forum post d1c96a9032e564f8. (check-in: d32757dd user: drh tags: trunk)
2022-12-28
14:03
Version 3.40.1 (check-in: df5c253c user: drh tags: release, version-3.40.1, branch-3.40)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/zipfile.c.
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
    if( rc!=SQLITE_OK ) return rc;
    bInMemory = 1;
  }else{
    zFile = (const char*)sqlite3_value_text(argv[0]);
  }

  if( 0==pTab->pWriteFd && 0==bInMemory ){
    pCsr->pFile = fopen(zFile, "rb");
    if( pCsr->pFile==0 ){
      zipfileCursorErr(pCsr, "cannot open file: %s", zFile);
      rc = SQLITE_ERROR;
    }else{
      rc = zipfileReadEOCD(pTab, 0, 0, pCsr->pFile, &pCsr->eocd);
      if( rc==SQLITE_OK ){
        if( pCsr->eocd.nEntry==0 ){







|







1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
    if( rc!=SQLITE_OK ) return rc;
    bInMemory = 1;
  }else{
    zFile = (const char*)sqlite3_value_text(argv[0]);
  }

  if( 0==pTab->pWriteFd && 0==bInMemory ){
    pCsr->pFile = zFile ? fopen(zFile, "rb") : 0;
    if( pCsr->pFile==0 ){
      zipfileCursorErr(pCsr, "cannot open file: %s", zFile);
      rc = SQLITE_ERROR;
    }else{
      rc = zipfileReadEOCD(pTab, 0, 0, pCsr->pFile, &pCsr->eocd);
      if( rc==SQLITE_OK ){
        if( pCsr->eocd.nEntry==0 ){
Changes to test/zipfile.test.
849
850
851
852
853
854
855
856








857
858
     VALUES(9223372036854775807),
           (-9223372036854775808),
           (9223372036854775806),
           (-9223372036854775807)
  )
  SELECT DISTINCT typeof(zipfile(0,0,x,0)) FROM vlist;
} {blob}
  









finish_test







|
>
>
>
>
>
>
>
>


849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
     VALUES(9223372036854775807),
           (-9223372036854775808),
           (9223372036854775806),
           (-9223372036854775807)
  )
  SELECT DISTINCT typeof(zipfile(0,0,x,0)) FROM vlist;
} {blob}

# 2023-01-04
# https://sqlite.org/forum/forumpost/d1c96a9032e564f8
# Call to fopen() with a NULL filename.
#
do_catchsql_test 18.1 {
  SELECT * FROM zipfile(NULL);
} {1 {cannot open file: }}


finish_test