facebook / facebook/folly

small_vector overflow

Open
#1,402 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

Hi guys when I run facebook mvfst and I run the demo tperf I met a problem that client broke out with Internal Error, and finally I
found that this was caused by the function named makeSizeInternal in small_vector.h and it threw exception: max_size exceeded in small_vector. I replace excption code with LOG(INFO) << newSize << " " << max_size() << " " << capacity(); and the result is "32768 32767 32767" every time I run tperf

I wonder why function "emplace_back" in small_vector.h calls "makeSize" with first param being "size() + 1", in light of this I modify the "if" condition "newSize > max_size()" into "newSize > max_size() + 1" in function "makeSizeInternal", it can prevent the overflow, but it is likely to be a improper choice.
So I want to know what kind of method may solve this problem. Thanks!

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.