Giter Club home page Giter Club logo

aws_auth's People

Contributors

golddranks avatar

Watchers

 avatar  avatar  avatar

aws_auth's Issues

Unsound implementation of `chunk(_mut)_hex_sha256`

The source of unsoundness

Hi, we found that there are two functions might have unsound implementation

fn chunk_sha256(input_buf: &[u8; 32]) -> &[u32; 8] {
let reinterpret_ptr = input_buf as *const [u8; 32] as *const [u32; 8];
unsafe { &*reinterpret_ptr }

The misaligned pointer was created at line 2, and deref at next line. Misaligned pointer dereference is an undefined behavior which we should avoid in safe function. Similar problem happens in chunk_mut_hex_sha256.

To reproduce the bug

cargo test could trigger the undefined behavior in chunk_mut_hex_sha256.

running 18 tests
test c_request::test_generate_c_request ... ok
test c_request::test_split_url ... ok
test c_request::test_hashing_c_request ... ok
test keys::tests::test_generation ... ok
test keys::tests::test_signing ... ok
test string_to_sign::tests::test_string_to_sign_2 ... ok
test util::hex::tests::test_expand_nibbles ... ok
test string_to_sign::tests::test_string_to_sign_1 ... ok
test util::hex::tests::test_nibbles_to_hex ... ok
test util::hex::tests::test_write_sha256_hex_3 ... ok
test util::hex::tests::test_write_u32_lowercase_hex ... ok
test util::test_push_lowercase ... ok
test util::url_encode::test_encode_path ... ok
test util::url_encode::test_safe_or_not ... ok
test vocab::test_hash_empty ... ok
thread 'auth_header::test_auth_header' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0x7fb89c000e0c', src/util/hex.rs:8:14

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.