From d9c3e7cb3684d863496ec9c17b77a5146e4bc936 Mon Sep 17 00:00:00 2001 From: Eric Astor Date: Tue, 23 Jun 2020 10:02:16 -0400 Subject: [PATCH] Avoid use of variable-length arrays when not necessary Change-Id: I45872ed02bbcf49b2709276dbb38cf72fab5cb1c Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2259335 Reviewed-by: Mark Mentovai --- snapshot/sanitized/sanitization_information.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snapshot/sanitized/sanitization_information.cc b/snapshot/sanitized/sanitization_information.cc index 5f7756f7..325365bf 100644 --- a/snapshot/sanitized/sanitization_information.cc +++ b/snapshot/sanitized/sanitization_information.cc @@ -88,8 +88,9 @@ bool ReadMemoryRangeWhitelist( return false; } - SanitizationMemoryRangeWhitelist::Range ranges[list.size]; - if (!memory.Read(list.entries, sizeof(ranges), &ranges)) { + std::vector ranges(list.size); + if (!memory.Read(list.entries, sizeof(ranges[0]) * list.size, + ranges.data())) { LOG(ERROR) << "Failed to read memory range whitelist entries."; return false; }