google / google/googletest

Crash with std::bad_alloc when building against latest abseil 20200923.1

Open
#3,071 3 comments 0 reactions 1 assignee Claimed by @derekmauro View on GitHub
More Information Requested
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

I'm trying to build against abseil and found a new release 20200923.1 from two weeks ago. I build using cmake, by adding the definition `GTEST_HAS_ABSL` and linking against the required absl libraries. The build works fine and I did not see any noteworthy warnings.

However when running google test, I get a `std::bad_alloc` on every `ASSERT`. I traced the problem in gtest to
https://github.com/google/googletest/blob/master/googletest/src/gtest.cc#L4834, and from there into absl to
https://github.com/abseil/abseil-cpp/blob/4b915e70929ca2d6152240facc83d3d38c5d5f28/absl/strings/str_cat.cc#L202

If I replace `absl::StrAppend(&result, kElidedFramesMarker, "\n");` with a simple `result += std::string(kElidedFramesMarker) + "\n";` everything works as expected.

I'm a bit lost there as to what is going wrong, help would be appreciated.

I tried with gtest 1.10.0 and latest master, both show the same behavior.

My environment is Ubuntu 20.04 with gcc9, x86_64. I've set the c++ standard to c++17 in absl.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.