commit/galaxy-central: Dave Bouvier: Add a sanity check to the twobit sniffer.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d34d6d1da813/ Changeset: d34d6d1da813 User: Dave Bouvier Date: 2013-08-01 21:03:37 Summary: Add a sanity check to the twobit sniffer. Affected #: 1 file diff -r 143f7f55098ae936481e5fcb1be85a3e5b5f159b -r d34d6d1da813bfa6e318b0ceb563186e52d94095 lib/galaxy/datatypes/binary.py --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -475,6 +475,9 @@ def sniff(self, filename): try: + # All twobit files start with a 16-byte header. If the file is smaller than 16 bytes, it's obviously not a valid twobit file. + if os.path.getsize(filename) < 16: + return False input = file(filename) magic = struct.unpack(">L", input.read(TWOBIT_MAGIC_SIZE))[0] if magic == TWOBIT_MAGIC_NUMBER or magic == TWOBIT_MAGIC_NUMBER_SWAP: Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org