@@ -270,8 +270,7 @@ def _EndRecData64(fpin, offset, endrec):
270270 if diskno != 0 or disks > 1 :
271271 raise BadZipFile ("zipfiles that span multiple disks are not supported" )
272272
273- # Assume no 'zip64 extensible data'
274- fpin .seek (offset - sizeEndCentDir64Locator - sizeEndCentDir64 , 2 )
273+ fpin .seek (reloff , 0 )
275274 data = fpin .read (sizeEndCentDir64 )
276275 if len (data ) != sizeEndCentDir64 :
277276 return endrec
@@ -281,6 +280,8 @@ def _EndRecData64(fpin, offset, endrec):
281280 if sig != stringEndArchive64 :
282281 return endrec
283282
283+ size_zip64_tail_records = sz + 12 + sizeEndCentDir64Locator
284+
284285 # Update the original endrec using data from the ZIP64 record
285286 endrec [_ECD_SIGNATURE ] = sig
286287 endrec [_ECD_DISK_NUMBER ] = disk_num
@@ -289,6 +290,8 @@ def _EndRecData64(fpin, offset, endrec):
289290 endrec [_ECD_ENTRIES_TOTAL ] = dircount2
290291 endrec [_ECD_SIZE ] = dirsize
291292 endrec [_ECD_OFFSET ] = diroffset
293+ # Adjust location for Zip64 extension structures
294+ endrec [_ECD_LOCATION ] -= size_zip64_tail_records
292295 return endrec
293296
294297
@@ -1453,9 +1456,6 @@ def _RealGetContents(self):
14531456
14541457 # "concat" is zero, unless zip was concatenated to another file
14551458 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 )
14591459
14601460 if self .debug > 2 :
14611461 inferred = concat + offset_cd
0 commit comments