[Git][reproducible-builds/diffoscope][master] Use "surrogateescape" mechanism to avoid a UnicodeDecodeError and crash when...

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon Jan 20 10:05:09 UTC 2025



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
9a0faeed by Chris Lamb at 2025-01-20T10:04:41+00:00
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:".

- - - - -


1 changed file:

- diffoscope/comparators/zip.py


Changes:

=====================================
diffoscope/comparators/zip.py
=====================================
@@ -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")
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/9a0faeedabd41019d135d4bdfef233400e4aff20

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/9a0faeedabd41019d135d4bdfef233400e4aff20
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20250120/133e134f/attachment.htm>


More information about the rb-commits mailing list