debug: Avoid underflow when scanning for landing pad bytes (#2866)
This commit is contained in:
@@ -512,9 +512,11 @@ where
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find all landing pads by scanning bytes, do not care about
|
// Find all landing pads by scanning bytes, do not care about
|
||||||
// false location at this moment.
|
// false location at this moment.
|
||||||
// Looks hacky but it is fast; does not need to be really exact.
|
// Looks hacky but it is fast; does not need to be really exact.
|
||||||
|
if buf.len() > 2 {
|
||||||
for i in 0..buf.len() - 2 {
|
for i in 0..buf.len() - 2 {
|
||||||
let op = buf[i];
|
let op = buf[i];
|
||||||
if op == gimli::constants::DW_OP_bra.0 || op == gimli::constants::DW_OP_skip.0 {
|
if op == gimli::constants::DW_OP_bra.0 || op == gimli::constants::DW_OP_skip.0 {
|
||||||
@@ -530,6 +532,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while !pc.is_empty() {
|
while !pc.is_empty() {
|
||||||
let unread_bytes = pc.len().into_u64();
|
let unread_bytes = pc.len().into_u64();
|
||||||
if let Some(marker) = jump_targets.get(&unread_bytes) {
|
if let Some(marker) = jump_targets.get(&unread_bytes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user