mirror of https://github.com/encounter/objdiff.git
Fix data tooltip panic (#123)
* Fix data tooltip panic Prevents panicing when attempting to display the data tooltip for a symbol that is too large by just using as many bytes as needed from the begging of the symbol. * Don't attempt to interpret wrongly sized data * Reference data display improvment issue * Log failure to display a symbol's value
This commit is contained in:
parent
72ea1c8911
commit
67b63311fc
|
@ -34,7 +34,11 @@ pub enum DataType {
|
||||||
|
|
||||||
impl DataType {
|
impl DataType {
|
||||||
pub fn display_bytes<Endian: ByteOrder>(&self, bytes: &[u8]) -> Option<String> {
|
pub fn display_bytes<Endian: ByteOrder>(&self, bytes: &[u8]) -> Option<String> {
|
||||||
if self.required_len().is_some_and(|l| bytes.len() < l) {
|
// TODO: Attempt to interpret large symbols as arrays of a smaller type,
|
||||||
|
// fallback to intrepreting it as bytes.
|
||||||
|
// https://github.com/encounter/objdiff/issues/124
|
||||||
|
if self.required_len().is_some_and(|l| bytes.len() != l) {
|
||||||
|
log::warn!("Failed to display a symbol value for a symbol whose size doesn't match the instruction referencing it.");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue