From 41b90c6e46d288d0ab3c466fc419cd4139511c20 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sun, 20 Apr 2025 17:14:13 -0700 Subject: [PATCH] correct heap_print.rs for null characters being excluded from pstr regions of heap (#2890) --- src/heap_print.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/heap_print.rs b/src/heap_print.rs index c2b60657..7bd227e2 100644 --- a/src/heap_print.rs +++ b/src/heap_print.rs @@ -1252,7 +1252,6 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { HeapCellValueTag::PStrLoc => { self.iter.pop_stack(); } - // HeapCellValueTag::CStr => {} _ => { unreachable!(); } @@ -1572,10 +1571,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { let c = self.iter.heap.char_at(pstr_loc); - if c != '\u{0}' || pstr_loc % std::mem::size_of::() == 0 { - // if a null character in a pstr has location aligned - // to a cell boundary, the string is ['\\x0\\']. - + if c != '\u{0}' { if !self.max_depth_exhausted(max_depth) { self.state_stack .push(TokenOrRedirect::CommaSeparatedCharList( @@ -1724,7 +1720,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { (HeapCellValueTag::F64, f) => { self.print_number(max_depth, NumberFocus::Unfocused(Number::Float(*f)), &op); } - (HeapCellValueTag::PStrLoc) => { // HeapCellValueTag::CStr | HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => { + (HeapCellValueTag::PStrLoc) => { self.print_list_like(max_depth); } (HeapCellValueTag::Lis) => { -- 2.54.0