llvm-undname: Tweak arena allocator
authorNico Weber <nicolasweber@gmx.de>
Tue, 16 Apr 2019 13:52:30 +0000 (13:52 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 16 Apr 2019 13:52:30 +0000 (13:52 +0000)
commitaa18ae862d220d5e9a89668096054c58a6975e93
treeb549d8892a6a8d469ad6c1a637c1de67bfc87aa4
parent5961b0203a642d20675de5e722c90e211d06d2c4
llvm-undname: Tweak arena allocator

- Make `allocUnalignedBuffer` look more like `allocArray` and `alloc`.
  No behavior change.
- Change `Head->Used < Head->Capacity` to `Head->Used <= Head->Capacity`
  in `allocArray` and `alloc`. No intended behavior change, might be a
  minuscule memory usage improvement. Noticed this since it was the logic
  used in `allocUnalignedBuffer`.
- Don't let `allocArray` alloc too small buffers for names that have
  more than 512 levels of nesting (in 64-bit builds). Fixes a heap
  buffer overflow found by oss-fuzz.

Differential Revision: https://reviews.llvm.org/D60774

llvm-svn: 358489
llvm/include/llvm/Demangle/MicrosoftDemangle.h
llvm/test/Demangle/ms-nested-scopes.test