Code Monkey home page Code Monkey logo

Comments (3)

MarijnS95 avatar MarijnS95 commented on July 23, 2024 1

Hmm that looks to have been a bad change in 384e7fb, this struct isn't marked as repr(C) either.

If you look at enum Memory for example 0 isn't a valid bit-pattern, only values 1-4 are valid (anything else is UB):

libv4l-rs/src/memory.rs

Lines 12 to 19 in 9844291

#[repr(u32)]
#[derive(Debug, Clone, Copy)]
pub enum Memory {
Mmap = 1,
UserPtr = 2,
Overlay = 3,
DmaBuf = 4,
}

@raymanfx is it okay if I replace these with default() once again?

from libv4l-rs.

MarijnS95 avatar MarijnS95 commented on July 23, 2024

Hmm it looks like the conversion from v4l2_buffer -> Metadata -> v4l2_buffer is also lossy.

from libv4l-rs.

MarijnS95 avatar MarijnS95 commented on July 23, 2024

For this specific case in mmap/stream.rs, I'm thinking of either wrapping it in MaybeUninit with // SAFETY docs about self.arena_index being valid, or wrapping it in an Option with an unwrap().

EDIT: Since there are user APIs passing arbitrary indices around, I'm leaning towards Option for additional validation.

from libv4l-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.