mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
crosvm: Ensure slices are the same size when copying.
Bug=b/135190799 TEST=run cuttlefish in debian host Change-Id: I7f9343dd202da2a163b3e8aeb8fbde5eb4cfb1d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1659144 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Cody Schuffelen <schuffelen@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Auto-Submit: Jorge Moreira Broche <jemoreira@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org>
This commit is contained in:
parent
c62f41681c
commit
0dfe1be88a
1 changed files with 1 additions and 1 deletions
|
@ -178,7 +178,7 @@ where
|
||||||
// otherwise source and destination would be the same.
|
// otherwise source and destination would be the same.
|
||||||
if buff_size != remainder {
|
if buff_size != remainder {
|
||||||
let (des, src) = self.read_buffer.buffer.split_at_mut(buff_size - remainder);
|
let (des, src) = self.read_buffer.buffer.split_at_mut(buff_size - remainder);
|
||||||
des[..remainder].copy_from_slice(src);
|
des[..remainder].copy_from_slice(&src[..remainder]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.read_idx = remainder;
|
self.read_idx = remainder;
|
||||||
|
|
Loading…
Reference in a new issue