diff options
author | Nathan Sidwell <nathan@acm.org> | 2022-02-07 11:33:08 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2022-02-14 03:59:31 -0800 |
commit | 995c4f306890ad379de19106f053238ce89f1483 (patch) | |
tree | 95fc23f27a9292f037feaa3c71544ae122b48b4d /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 5a43a278f7f6a9bba0a630634534a37e060f24d0 (diff) | |
download | llvm-995c4f306890ad379de19106f053238ce89f1483.zip llvm-995c4f306890ad379de19106f053238ce89f1483.tar.gz llvm-995c4f306890ad379de19106f053238ce89f1483.tar.bz2 |
[demangler] Fix buffer growth
The output buffer growth algorithm had a few issues:
a) An off-by-one error in the initial size check, which uses
'>='. This error was safe, but could cause us to reallocate when there
was no need.
b) An inconsistency between the initial size check (>=) and the
post-doubling check (>). The latter was somewhat obscured by the
swapped operands.
c) There would be many reallocs with an initially-small buffer. Add a
little initialization hysteresis.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D119177
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions