@@ -270,8 +270,7 @@ def _EndRecData64(fpin, offset, endrec):
270
270
if diskno != 0 or disks > 1 :
271
271
raise BadZipFile ("zipfiles that span multiple disks are not supported" )
272
272
273
- # Assume no 'zip64 extensible data'
274
- fpin .seek (offset - sizeEndCentDir64Locator - sizeEndCentDir64 , 2 )
273
+ fpin .seek (reloff , 0 )
275
274
data = fpin .read (sizeEndCentDir64 )
276
275
if len (data ) != sizeEndCentDir64 :
277
276
return endrec
@@ -281,6 +280,8 @@ def _EndRecData64(fpin, offset, endrec):
281
280
if sig != stringEndArchive64 :
282
281
return endrec
283
282
283
+ size_zip64_tail_records = sz + 12 + sizeEndCentDir64Locator
284
+
284
285
# Update the original endrec using data from the ZIP64 record
285
286
endrec [_ECD_SIGNATURE ] = sig
286
287
endrec [_ECD_DISK_NUMBER ] = disk_num
@@ -289,6 +290,8 @@ def _EndRecData64(fpin, offset, endrec):
289
290
endrec [_ECD_ENTRIES_TOTAL ] = dircount2
290
291
endrec [_ECD_SIZE ] = dirsize
291
292
endrec [_ECD_OFFSET ] = diroffset
293
+ # Adjust location for Zip64 extension structures
294
+ endrec [_ECD_LOCATION ] -= size_zip64_tail_records
292
295
return endrec
293
296
294
297
@@ -1453,9 +1456,6 @@ def _RealGetContents(self):
1453
1456
1454
1457
# "concat" is zero, unless zip was concatenated to another file
1455
1458
concat = endrec [_ECD_LOCATION ] - size_cd - offset_cd
1456
- if endrec [_ECD_SIGNATURE ] == stringEndArchive64 :
1457
- # If Zip64 extension structures are present, account for them
1458
- concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator )
1459
1459
1460
1460
if self .debug > 2 :
1461
1461
inferred = concat + offset_cd
0 commit comments