Commit 8cf30aa2 authored by Victor Zverovich's avatar Victor Zverovich

Fix segfault on complex pointer formatting (#642)

parent 0555cea5
......@@ -3000,13 +3000,13 @@ typename BasicWriter<Char>::CharPtr
CharPtr p = grow_buffer(fill_size);
std::uninitialized_fill(p, p + fill_size, fill);
}
CharPtr result = prepare_int_buffer(
num_digits, subspec, prefix, prefix_size);
std::ptrdiff_t offset = get(prepare_int_buffer(
num_digits, subspec, prefix, prefix_size)) - &buffer_[0];
if (align == ALIGN_LEFT) {
CharPtr p = grow_buffer(fill_size);
std::uninitialized_fill(p, p + fill_size, fill);
}
return result;
return internal::make_ptr(&buffer_[0], buffer_.size()) + offset;
}
unsigned size = prefix_size + num_digits;
if (width <= size) {
......
......@@ -1761,3 +1761,7 @@ void convert(int);
TEST(FormatTest, ConvertCollision) {
fmt::format("{}", 42);
}
TEST(FormatTest, Regression) {
fmt::format("...........{:<77777.7p}", "foo");
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment