-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor fixes to QCatchSyscalls support
- Refactor syscall number parsing code. - Add support returning error codes from catch syscall handlers
- Loading branch information
Showing
10 changed files
with
64 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::protocol::common::hex::{decode_hex_buf, is_hex}; | ||
|
||
/// A wrapper type around a list of hex encoded arguments separated by `;`. | ||
#[derive(Debug)] | ||
pub struct ArgListHex<'a>(&'a mut [u8]); | ||
|
||
impl<'a> ArgListHex<'a> { | ||
pub fn from_packet(args: &'a mut [u8]) -> Option<Self> { | ||
// validate that args have valid hex encoding (with ';' delimiters). | ||
// this removes all the error handling from the lazy `Args` iterator. | ||
if args.iter().any(|b| !(is_hex(*b) || *b == b';')) { | ||
return None; | ||
} | ||
Some(Self(args)) | ||
} | ||
|
||
pub fn into_iter(self) -> impl Iterator<Item = &'a [u8]> + 'a { | ||
self.0 | ||
.split_mut(|b| *b == b';') | ||
// the `from_packet` method guarantees that the args are valid hex ascii, so this should | ||
// method should never fail. | ||
.map(|raw| decode_hex_buf(raw).unwrap_or(&mut [])) | ||
.map(|s| s as &[u8]) | ||
.filter(|s| !s.is_empty()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters