Skip to content

basic_istream::read/basic_istream::read_some and basic::ostream::write should be marked with [[clang::unsafe_buffer_usage]] #164972

@SidneyCogdill

Description

@SidneyCogdill

https://godbolt.org/z/e77vEEz7h

#include <iostream>
#include <array>

auto f(std::ostream &st, char *p, std::size_t s) {
    st.write(p, s);
}

auto g(std::istream &st, char *p, std::size_t s) {
    st.read(p, s);
}

int main() {
    std::array<char, 1> a;
    f(std::cout, a.data(), 100);
    g(std::cin, a.data(), 100);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateResolved as duplicatelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions