88c20d965de6342244ba942f8a355ebfb2f8133c,PyInstaller/archive/readers.py,CArchiveReader,checkmagic,#CArchiveReader#,132

Before Change


            self.lib.seek(filelen-self._cookie_size, 0)
            (magic, totallen, tocpos, toclen, pyvers, pylib_name) = struct.unpack(
                self._cookie_format, self.lib.read(self._cookie_size))
            if magic != self.MAGIC:
                filelen -= 1
            else:
                found = True
                break
                
                
        if not found:
            raise RuntimeError("%s is not a valid %s archive file" %
                               (self.path, self.__class__.__name__))

After Change


        
        self.lib.seek(max(0, filelen-4096)) 
        searchpos = self.lib.tell()
        buf = self.lib.read(min(filelen, 4096))
        pos = buf.rfind(self.MAGIC)
        if pos == -1:
            raise RuntimeError("%s is not a valid %s archive file" %
                               (self.path, self.__class__.__name__))
        filelen = searchpos + pos + self._cookie_size
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pyinstaller/pyinstaller
Commit Name: 88c20d965de6342244ba942f8a355ebfb2f8133c
Time: 2016-02-29
Author: garth@garthy.com
File Name: PyInstaller/archive/readers.py
Class Name: CArchiveReader
Method Name: checkmagic


Project Name: bokeh/bokeh
Commit Name: 850fa9913b2f24729cd4c58b4037697ab028c52a
Time: 2018-06-04
Author: bryanv@anaconda.com
File Name: bokeh/command/subcommands/tests/test_serve.py
Class Name:
Method Name: test_actual_port_printed_out


Project Name: theislab/scanpy
Commit Name: ab9247bdf8b7a3decc34a15b26fec813ea8fba0d
Time: 2020-07-31
Author: ivirshup@gmail.com
File Name: scanpy/readwrite.py
Class Name:
Method Name: _download