From b56cbdd23834a65682c0b46f367f8679e83bc894 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 18 Sep 2020 15:55:15 -0700 Subject: Abseil LTS 20200923 What's New: * `absl::StatusOr` has been released. See our [blog post](https://abseil.io/blog/2020-091021-status) for more information. * Abseil Flags reflection interfaces have been released. * Abseil Flags memory usage has been significantly optimized. * Abseil now supports a "hardened" build mode. This build mode enables runtime checks that guard against programming errors that may lead to security vulnerabilities. Notable Fixes: * Sanitizer dynamic annotations like `AnnotateRWLockCreate` that are also defined by the compiler sanitizer implementation are no longer also defined by Abseil. * Sanitizer macros are now prefixed with `ABSL_` to avoid naming collisions. * Sanitizer usage is now automatically detected and no longer requires macros like `ADDRESS_SANITIZER` to be defined on the command line. Breaking Changes: * Abseil no longer contains a `dynamic_annotations` library. Users using a supported build system (Bazel or CMake) are unaffected by this, but users manually specifying link libraries may get an error about a missing linker input. Baseline: 7680a5f8efe32de4753baadbd63e74e59d95bac1 Cherry picks: None --- absl/types/span_test.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'absl/types/span_test.cc') diff --git a/absl/types/span_test.cc b/absl/types/span_test.cc index 22467a0a..2584339b 100644 --- a/absl/types/span_test.cc +++ b/absl/types/span_test.cc @@ -27,6 +27,7 @@ #include "absl/base/attributes.h" #include "absl/base/config.h" #include "absl/base/internal/exception_testing.h" +#include "absl/base/options.h" #include "absl/container/fixed_array.h" #include "absl/container/inlined_vector.h" #include "absl/hash/hash_testing.h" @@ -232,6 +233,11 @@ TEST(IntSpan, ElementAccess) { EXPECT_EQ(s.front(), s[0]); EXPECT_EQ(s.back(), s[9]); + +#if !defined(NDEBUG) || ABSL_OPTION_HARDENED + EXPECT_DEATH_IF_SUPPORTED(s[-1], ""); + EXPECT_DEATH_IF_SUPPORTED(s[10], ""); +#endif } TEST(IntSpan, AtThrows) { @@ -268,6 +274,13 @@ TEST(IntSpan, RemovePrefixAndSuffix) { EXPECT_EQ(s.size(), 0); EXPECT_EQ(v, MakeRamp(20, 1)); + +#if !defined(NDEBUG) || ABSL_OPTION_HARDENED + absl::Span prefix_death(v); + EXPECT_DEATH_IF_SUPPORTED(prefix_death.remove_prefix(21), ""); + absl::Span suffix_death(v); + EXPECT_DEATH_IF_SUPPORTED(suffix_death.remove_suffix(21), ""); +#endif } TEST(IntSpan, Subspan) { -- cgit v1.2.3