Pull in hardened BPF virtual machine (#9931)

This commit is contained in:
Jack May
2020-05-08 12:37:04 -07:00
committed by GitHub
parent 57a9996921
commit 84885d79d5
8 changed files with 342 additions and 688 deletions

View File

@@ -25,7 +25,7 @@ impl BPFAllocator {
impl Alloc for BPFAllocator {
fn alloc(&mut self, layout: Layout) -> Result<u64, AllocErr> {
if self.pos + layout.size() as u64 <= self.len {
if self.pos.saturating_add(layout.size() as u64) <= self.len {
let addr = self.start + self.pos;
self.pos += layout.size() as u64;
Ok(addr)