[Reproducible-commits] [diffoscope] 08/13: Read Haskell interfaces in binary mode

Jérémy Bobbio lunar at moszumanska.debian.org
Thu Oct 15 16:04:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository diffoscope.

commit e26a9dea7127c6641bddadf76711bb5ac4982458
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Thu Oct 15 10:16:34 2015 +0000

    Read Haskell interfaces in binary mode
    
    Otherwise, we'll get Unicode decode errors. Bad.
    
    Closes: #801333
---
 diffoscope/comparators/cbfs.py    | 2 +-
 diffoscope/comparators/haskell.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/cbfs.py b/diffoscope/comparators/cbfs.py
index 523a1d5..bf708dd 100644
--- a/diffoscope/comparators/cbfs.py
+++ b/diffoscope/comparators/cbfs.py
@@ -105,7 +105,7 @@ class CbfsFile(File):
                 #           that field is now bound to be little endian
                 #   -- #coreboot, 2015-10-14
                 rel_offset = struct.unpack('<i', f.read(4))[0]
-                if rel_offset < 0 and -rel_offset > CBFS_HEADER_SIZE:
+                if rel_offset < 0 and -rel_offset > CBFS_HEADER_SIZE and -rel_offset < size:
                     f.seek(rel_offset, io.SEEK_END)
                     logger.debug('looking for header at offset: %x', f.tell())
                     if is_header_valid(f.read(CBFS_HEADER_SIZE), size):
diff --git a/diffoscope/comparators/haskell.py b/diffoscope/comparators/haskell.py
index b4c0a9b..6f696fa 100644
--- a/diffoscope/comparators/haskell.py
+++ b/diffoscope/comparators/haskell.py
@@ -61,7 +61,7 @@ class HiFile(File):
             return False
 
         with file.get_content():
-            with open(file.path) as fp:
+            with open(file.path, 'rb') as fp:
                 # read magic
                 buf = fp.read(4)
                 if buf != HI_MAGIC:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list