From f59c70a8364a2a89f678d5257ff2ee9175e90041 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2020 17:46:02 +0000 Subject: [PATCH] Print the entry type as well when checking archive (#13312) (#13313) (cherry picked from commit bc7133d7526a041d1aaee807b80922baa89b6f90) Co-authored-by: Ryo Onodera --- runtime/src/hardened_unpack.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/src/hardened_unpack.rs b/runtime/src/hardened_unpack.rs index a3976554f3..69c21e59e5 100644 --- a/runtime/src/hardened_unpack.rs +++ b/runtime/src/hardened_unpack.rs @@ -103,8 +103,9 @@ where let parts: Vec<_> = parts.map(|p| p.unwrap()).collect(); if !entry_checker(parts.as_slice(), entry.header().entry_type()) { return Err(UnpackError::Archive(format!( - "extra entry found: {:?}", - path_str + "extra entry found: {:?} {:?}", + path_str, + entry.header().entry_type(), ))); } total_size = checked_total_size_sum(total_size, entry.header().size()?, limit_size)?; @@ -451,7 +452,7 @@ mod tests { let mut archive = Builder::new(Vec::new()); archive.append(&header, data).unwrap(); let result = finalize_and_unpack_snapshot(archive); - assert_matches!(result, Err(UnpackError::Archive(ref message)) if message == "extra entry found: \"foo\""); + assert_matches!(result, Err(UnpackError::Archive(ref message)) if message == "extra entry found: \"foo\" Regular"); } #[test]