SQLite

Check-in [8f7a592f8c]
Login

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

Overview
Comment:Fix harmless compiler warnings in zipfile.c.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8f7a592f8c044d75b4615a95e27454100b10c2b26f4cafee97dec23343821130
User & Date: drh 2018-01-13 23:28:33.571
Context
2018-01-14
20:12
Avoid excess stack usage when a VALUES clause with lots of rows occurs within a scalar expression. This fixes a problem discovered by OSSFuzz. (check-in: a4fa0581ba user: drh tags: trunk)
2018-01-13
23:28
Fix harmless compiler warnings in zipfile.c. (check-in: 8f7a592f8c user: drh tags: trunk)
19:08
Support UPDATE statements against zipfile virtual tables. (check-in: f2d2a5df4f user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/misc/zipfile.c.
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
  int bIsDir = 0;

  assert( pTab->zFile );
  assert( pTab->pWriteFd );

  if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
    const char *zDelete = (const char*)sqlite3_value_text(apVal[0]);
    int nDelete = strlen(zDelete);
    for(pOld=pTab->pFirstEntry; 1; pOld=pOld->pNext){
      if( pOld->bDeleted ) continue;
      if( zipfileComparePath(pOld->zPath, zDelete, nDelete)==0 ){
        pOld->bDeleted = 1;
        break;
      }
      assert( pOld->pNext );
    }
    if( nVal==1 ) return SQLITE_OK;
  }

  if( sqlite3_value_nochange(apVal[5]) && sqlite3_value_nochange(apVal[6])
   && sqlite3_value_nochange(apVal[7]) && sqlite3_value_nochange(apVal[8])
  ){
    /* Reuse the data from the existing entry. */
    FILE *pFile = pTab->pWriteFd;
    ZipfileCDS cds;
    zipfileReadCDS(pOld->aCdsEntry, &cds);

    bIsDir = ((cds.iExternalAttr>>16) & S_IFDIR) ? 1 : 0;
    sz = cds.szUncompressed;
    iMethod = cds.iCompression;
    if( sz>0 ){
      char **pzErr = &pTab->base.zErrMsg;







|
















<







1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297

1298
1299
1300
1301
1302
1303
1304
  int bIsDir = 0;

  assert( pTab->zFile );
  assert( pTab->pWriteFd );

  if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
    const char *zDelete = (const char*)sqlite3_value_text(apVal[0]);
    int nDelete = (int)strlen(zDelete);
    for(pOld=pTab->pFirstEntry; 1; pOld=pOld->pNext){
      if( pOld->bDeleted ) continue;
      if( zipfileComparePath(pOld->zPath, zDelete, nDelete)==0 ){
        pOld->bDeleted = 1;
        break;
      }
      assert( pOld->pNext );
    }
    if( nVal==1 ) return SQLITE_OK;
  }

  if( sqlite3_value_nochange(apVal[5]) && sqlite3_value_nochange(apVal[6])
   && sqlite3_value_nochange(apVal[7]) && sqlite3_value_nochange(apVal[8])
  ){
    /* Reuse the data from the existing entry. */
    FILE *pFile = pTab->pWriteFd;

    zipfileReadCDS(pOld->aCdsEntry, &cds);

    bIsDir = ((cds.iExternalAttr>>16) & S_IFDIR) ? 1 : 0;
    sz = cds.szUncompressed;
    iMethod = cds.iCompression;
    if( sz>0 ){
      char **pzErr = &pTab->base.zErrMsg;