re-introduce old nss im too tired for this

This commit is contained in:
wuggy 2026-06-30 06:37:32 +01:00
commit 3a838106b9
2871 changed files with 1374431 additions and 1762417 deletions

View file

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This code is made available to you under your choice of the following sets
* of licensing terms:
*/
@ -246,13 +245,14 @@ TEST_F(pkixder_input_tests, ReadWordWithInsufficentData)
ASSERT_NE(0x1122, readWord1);
}
static void UNSANITIZED_ReadWordWrapAroundPointer()
#if defined(__clang__)
/* Use "undefined" instead of more specific "pointer-overflow" for
* clang 4.0.0 backward compatability. */
__attribute__((no_sanitize("undefined")))
#endif
TEST_F(pkixder_input_tests, ReadWordWrapAroundPointer)
{
// The original implementation of our buffer read overflow checks was
// susceptible to integer overflows which could make the checks ineffective.
// This attempts to verify that we've fixed that. Unfortunately, decrementing
// a null pointer is undefined behavior according to the C++ language spec.,
// but this should catch the problem on at least some compilers, if not all of
// them.
const uint8_t* der = nullptr;
--der;
Input buf;
@ -262,16 +262,6 @@ static void UNSANITIZED_ReadWordWrapAroundPointer()
ASSERT_EQ(Result::ERROR_BAD_DER, input.Read(b));
}
TEST_F(pkixder_input_tests, ReadWordWrapAroundPointer) {
// The original implementation of our buffer read overflow checks was
// susceptible to integer overflows which could make the checks ineffective.
// This attempts to verify that we've fixed that. Unfortunately, decrementing
// a null pointer is undefined behavior according to the C++ language spec.,
// but this should catch the problem on at least some compilers, if not all of
// them.
UNSANITIZED_ReadWordWrapAroundPointer();
}
TEST_F(pkixder_input_tests, Skip)
{
const uint8_t der[] = { 0x11, 0x22, 0x33, 0x44 };
@ -361,13 +351,14 @@ TEST_F(pkixder_input_tests, Skip_ToInput)
ASSERT_TRUE(InputsAreEqual(expected, item));
}
static void UNSANITIZED_Skip_WrapAroundPointer()
#if defined(__clang__)
/* Use "undefined" instead of more specific "pointer-overflow" for
* clang 4.0.0 backward compatability. */
__attribute__((no_sanitize("undefined")))
#endif
TEST_F(pkixder_input_tests, Skip_WrapAroundPointer)
{
// The original implementation of our buffer read overflow checks was
// susceptible to integer overflows which could make the checks ineffective.
// This attempts to verify that we've fixed that. Unfortunately, decrementing
// a null pointer is undefined behavior according to the C++ language spec.,
// but this should catch the problem on at least some compilers, if not all of
// them.
const uint8_t* der = nullptr;
// coverity[FORWARD_NULL]
--der;
@ -377,16 +368,6 @@ static void UNSANITIZED_Skip_WrapAroundPointer()
ASSERT_EQ(Result::ERROR_BAD_DER, input.Skip(1));
}
TEST_F(pkixder_input_tests, Skip_WrapAroundPointer) {
// The original implementation of our buffer read overflow checks was
// susceptible to integer overflows which could make the checks ineffective.
// This attempts to verify that we've fixed that. Unfortunately, decrementing
// a null pointer is undefined behavior according to the C++ language spec.,
// but this should catch the problem on at least some compilers, if not all of
// them.
UNSANITIZED_Skip_WrapAroundPointer();
}
TEST_F(pkixder_input_tests, Skip_ToInputPastEnd)
{
const uint8_t der[] = { 0x11, 0x22, 0x33, 0x44 };