From 3e13200091735d628645fdbb6f75784779dde871 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Thu, 23 Mar 2023 16:34:20 -0400 Subject: [PATCH] _subprocess: perform invalid UTF-8 substitution (#572) * _subprocess: perform invalid UTF-8 substitution Signed-off-by: William Woodruff * CHANGELOG: record changes Signed-off-by: William Woodruff --------- Signed-off-by: William Woodruff --- CHANGELOG.md | 5 +++++ pip_audit/_subprocess.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbdb5698..9330e6eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ All versions prior to 0.0.9 are untracked. behaviour when using hashed requirements or the `--no-deps` flag ([#540](https://github.com/pypa/pip-audit/pull/540)) +### Fixed + +* Fixed a crash caused by invalid UTF-8 sequences in subprocess outputs + ([#572](https://github.com/pypa/pip-audit/pull/572)) + ## [2.5.2] ### Fixed diff --git a/pip_audit/_subprocess.py b/pip_audit/_subprocess.py index 070db782..86aaa089 100644 --- a/pip_audit/_subprocess.py +++ b/pip_audit/_subprocess.py @@ -65,4 +65,4 @@ def run(args: Sequence[str], *, log_stdout: bool = False, state: AuditState = Au stderr=stderr.decode(errors="replace"), ) - return stdout.decode("utf-8") + return stdout.decode("utf-8", errors="replace")