mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:34 +00:00
Prevent overflow when columns >= 32
This commit is contained in:
1 parent
2a4a22c9cb
commit
85659a9cd6
1 file changed
+3
-3
+3
-3
@@ -301,7 +301,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
|
||||
self.byte_char_panel[b as usize]
|
||||
);
|
||||
|
||||
if idx % 8 == 0 && idx % (u64::from(self.columns * 8)) != 0 {
|
||||
if idx % 8 == 0 && idx % (u64::from(self.columns) * 8) != 0 {
|
||||
let _ = write!(&mut self.buffer_line, "{}", self.border_style.inner_sep());
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
|
||||
}
|
||||
|
||||
pub fn print_byte(&mut self, b: u8) -> io::Result<()> {
|
||||
if self.idx % u64::from(self.columns * 8) == 1 {
|
||||
if self.idx % (u64::from(self.columns) * 8) == 1 {
|
||||
self.print_header();
|
||||
self.print_position_panel();
|
||||
}
|
||||
@@ -334,7 +334,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
|
||||
|
||||
self.squeezer.process(b, self.idx);
|
||||
|
||||
if self.idx % u64::from(self.columns * 8) == 0 {
|
||||
if self.idx % (u64::from(self.columns) * 8) == 0 {
|
||||
self.print_textline()?;
|
||||
} else if self.idx % 8 == 0 {
|
||||
let _ = write!(&mut self.buffer_line, "{} ", self.border_style.inner_sep());
|
||||
|
||||
Reference in new issue
Block a user