mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 04:09:48 +00:00
media: ffmpeg: fix undefined behavior in test_avpacket_drop
The AvBufferSource pointer gets converted into a Rust slice, so it is not valid to use a null pointer (even though the length is 0). Return a valid pointer derived from an empty slice instead. BUG=b:365852007 Change-Id: I12930c98241d2d711826c577ae23944ec8d5d93b Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6013082 Reviewed-by: Alexandre Courbot <acourbot@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
ea6b766072
commit
147b0fe6c2
1 changed files with 1 additions and 2 deletions
|
@ -1041,7 +1041,6 @@ impl Drop for AvFrame {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::ptr;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
|
@ -1078,7 +1077,7 @@ mod tests {
|
|||
}
|
||||
impl AvBufferSource for DropTestBufferSource {
|
||||
fn as_ptr(&self) -> *const u8 {
|
||||
ptr::null()
|
||||
[].as_ptr()
|
||||
}
|
||||
|
||||
fn len(&self) -> usize {
|
||||
|
|
Loading…
Reference in a new issue