Commit 9a0faeed authored by Chris Lamb's avatar Chris Lamb 👀
Browse files

Use "surrogateescape" mechanism to avoid a UnicodeDecodeError and crash when...

Use "surrogateescape" mechanism to avoid a UnicodeDecodeError and crash when decoding zipinfo output that is not UTF-8 compliant. (Closes: Debian:#1093484)

Although the line in question pertains to strippings paths, we were decoding all lines that don't start with "Archive:".
parent 72df2175
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class Zipinfo(Command):

        # Strip paths from errors and warnings
        # eg: "warning [/full/path]: 472 extra bytes at beginning or within zipfile"
        m = self.re_strip_path.match(line.decode("utf-8"))
        m = self.re_strip_path.match(line.decode("utf-8", "surrogateescape"))
        if m is not None:
            return "{}: {}\n".format(m.group(1), m.group(2)).encode("utf-8")