Skip to content

Commit

Permalink
prevents an overflowing subtraction when using JLink
Browse files Browse the repository at this point in the history
  • Loading branch information
benbrittain committed Sep 9, 2022
1 parent f1111c8 commit fb0b872
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion humility-core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,9 @@ impl GDBCore {
// We are done when we have our closing delimter followed by
// the two byte checksum.
//
if result.find(GDB_PACKET_END) == Some(result.len() - 3) {
if result.len() >= 3
&& result.find(GDB_PACKET_END) == Some(result.len() - 3)
{
break;
}
}
Expand Down
3 changes: 2 additions & 1 deletion humility-core/src/hubris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ impl HubrisArchive {
let file = match header.file(file) {
Some(header) => header,
None => {
bail!("no header at {}", goff);
//bail!("no header at {}", goff);
return Ok(());
}
};

Expand Down

0 comments on commit fb0b872

Please sign in to comment.