Skip to content

Commit

Permalink
Add additional nullptr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Oct 17, 2024
1 parent ed231ec commit 27cd8c2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test_sha1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ void files_test()
0x47, 0x99, 0xb4, 0x7b, 0xd9, 0x25, 0x5a, 0xc9, 0xcb, 0x65};

test_file(filename_2, res_2);

const char* test_null_file = nullptr;
test_invalid_file(test_null_file);
}

void test_invalid_state()
Expand Down Expand Up @@ -436,6 +439,18 @@ void test_invalid_state()
const char* ptr = nullptr;
current_state = hasher.process_bytes(ptr, 4);
BOOST_TEST(current_state == boost::crypt::hasher_state::null);

const char16_t* ptr16 = nullptr;
current_state = hasher.process_bytes(ptr16, 4);
BOOST_TEST(current_state == boost::crypt::hasher_state::null);

const char32_t* ptr32 = nullptr;
current_state = hasher.process_bytes(ptr32, 4);
BOOST_TEST(current_state == boost::crypt::hasher_state::null);

const wchar_t* wptr = nullptr;
current_state = hasher.process_bytes(wptr, 4);
BOOST_TEST(current_state == boost::crypt::hasher_state::null);
}

int main()
Expand Down

0 comments on commit 27cd8c2

Please sign in to comment.