From 1fdd243276d7184bbc0acb0bda349283cf8cfbda Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 23 Jun 2024 15:31:25 -0700 Subject: fuzz caught negation bug --- src/long_mode/display.rs | 14 +++++++------- src/protected_mode/display.rs | 14 +++++++------- src/real_mode/display.rs | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index 4f4e739..37f832a 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -439,7 +439,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -472,7 +472,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -502,7 +502,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -517,7 +517,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -557,7 +557,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -588,7 +588,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -623,7 +623,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } diff --git a/src/protected_mode/display.rs b/src/protected_mode/display.rs index 0291246..bdc0e95 100644 --- a/src/protected_mode/display.rs +++ b/src/protected_mode/display.rs @@ -415,7 +415,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -448,7 +448,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -478,7 +478,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -493,7 +493,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -533,7 +533,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -564,7 +564,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -599,7 +599,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } diff --git a/src/real_mode/display.rs b/src/real_mode/display.rs index fdd51cf..8de8168 100644 --- a/src/real_mode/display.rs +++ b/src/real_mode/display.rs @@ -415,7 +415,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -448,7 +448,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -478,7 +478,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -493,7 +493,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -533,7 +533,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -564,7 +564,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } @@ -599,7 +599,7 @@ impl super::OperandVisitor for DisplayingOperandVisitor<'_, T> let mut v = disp as u32; if disp < 0 { self.f.write_fixed_size("- 0x")?; - v = -disp as u32; + v = disp.unsigned_abs(); } else { self.f.write_fixed_size("+ 0x")?; } -- cgit v1.1