Skip to content

Commit

Permalink
fn dav1d_data_create: limit maximum size to match C code
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Bossen committed Mar 24, 2024
1 parent a142e2d commit a5fb822
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ pub unsafe extern "C" fn dav1d_picture_unref(p: *mut Dav1dPicture) {
pub unsafe extern "C" fn dav1d_data_create(buf: *mut Dav1dData, sz: usize) -> *mut u8 {
|| -> Rav1dResult<*mut u8> {
let buf = validate_input!(NonNull::new(buf).ok_or(EINVAL))?;
validate_input!((sz <= usize::MAX / 2, EINVAL))?;
let data = Rav1dData::create(sz)?;
let data = data.to::<Dav1dData>();
let ptr = data
Expand Down

0 comments on commit a5fb822

Please sign in to comment.