Git Product home page Git Product logo

Comments (3)

liranringel avatar liranringel commented on July 19, 2024 2

Thanks for the report!
I fixed it, and I will publish a new version soon.

from ipconfig.

oherrala avatar oherrala commented on July 19, 2024

Rust 1.70.0 changelog has this line which might be relevant:

  • rust-lang/rust#98112 This catches undefined behavior at runtime, and may cause existing code to fail.

from ipconfig.

saethlin avatar saethlin commented on July 19, 2024

Ouch, yeah we don't test Windows targets in crater and I don't test them personally.

It looks to me like Windows is returning a pointer that is not sufficiently aligned. The standard library has used addr_of! to navigate such issues before, perhaps that would be viable fix here? https://github.com/rust-lang/rust/blob/f91b634643de14ab5156b0c084d80bd6845fb0ae/library/std/src/sys/windows/fs.rs#L766-L778

        let (name, is_directory, next_entry) = unsafe {
            let info = buffer.as_ptr().cast::<c::FILE_ID_BOTH_DIR_INFO>();
            // While this is guaranteed to be aligned in documentation for
            // https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_both_dir_info
            // it does not seem that reality is so kind, and assuming this
            // caused crashes in some cases (https://github.com/rust-lang/rust/issues/104530)
            // presumably, this can be blamed on buggy filesystem drivers, but who knows.
            let next_entry = ptr::addr_of!((*info).NextEntryOffset).read_unaligned() as usize;
            let length = ptr::addr_of!((*info).FileNameLength).read_unaligned() as usize;
            let attrs = ptr::addr_of!((*info).FileAttributes).read_unaligned();
            let name = from_maybe_unaligned(
                ptr::addr_of!((*info).FileName).cast::<u16>(),
                length / size_of::<u16>(),
            );

from ipconfig.

Related Issues (12)

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.