Use second version of patch for test 8 segfault
This commit is contained in:
parent
3ad49b7a23
commit
d74d6b6c48
@ -1,23 +1,38 @@
|
||||
From 6655e804c49f66b6c978fcdd01ef6b03b55208fa Mon Sep 17 00:00:00 2001
|
||||
From 032c83807f95d83f2355f1c436909bb577b920bc Mon Sep 17 00:00:00 2001
|
||||
From: Victor Zverovich <victor.zverovich@gmail.com>
|
||||
Date: Sun, 6 Aug 2017 20:18:04 -0700
|
||||
Subject: [PATCH] Fix a segfault in test on glibc 2.26 #551
|
||||
Date: Thu, 10 Aug 2017 09:27:06 -0700
|
||||
Subject: [PATCH] Fix a segfault in test on glibc 2.26 #551, take 2
|
||||
NOTE: Added ::internal so it would apply - DLJ
|
||||
|
||||
---
|
||||
test/util-test.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
test/util-test.cc | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/util-test.cc b/test/util-test.cc
|
||||
index a3882558..6cef7e81 100644
|
||||
index 6cef7e81..6617b857 100644
|
||||
--- a/test/util-test.cc
|
||||
+++ b/test/util-test.cc
|
||||
@@ -838,7 +838,7 @@ TEST(UtilTest, FormatSystemError) {
|
||||
@@ -837,8 +837,21 @@ TEST(UtilTest, FormatSystemError) {
|
||||
fmt::internal::format_system_error(message, EDOM, "test");
|
||||
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), message.str());
|
||||
message.clear();
|
||||
fmt::internal::format_system_error(
|
||||
- fmt::internal::format_system_error(
|
||||
- message, EDOM, fmt::StringRef(0, std::numeric_limits<size_t>::max()));
|
||||
+ message, EDOM, fmt::StringRef(0, std::numeric_limits<ssize_t>::max()));
|
||||
+
|
||||
+ // Check if std::allocator throws on allocating max size_t / 2 chars.
|
||||
+ size_t max_size = std::numeric_limits<size_t>::max() / 2;
|
||||
+ bool throws_on_alloc = false;
|
||||
+ try {
|
||||
+ std::allocator<char> alloc;
|
||||
+ alloc.deallocate(alloc.allocate(max_size), max_size);
|
||||
+ } catch (std::bad_alloc) {
|
||||
+ throws_on_alloc = true;
|
||||
+ }
|
||||
+ if (!throws_on_alloc) {
|
||||
+ fmt::print("warning: std::allocator allocates {} chars", max_size);
|
||||
+ return;
|
||||
+ }
|
||||
+ fmt::internal::format_system_error(message, EDOM, fmt::StringRef(0, max_size));
|
||||
EXPECT_EQ(fmt::format("error {}", EDOM), message.str());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user