Changesets · Branches · Tags · Compare
| Changeset | cddc29aadae50bf5e69dfd40090b86b0df12b32b0220d4efef72c690c53ba20e |
|---|---|
| Author | Patryk Kaiser <patryk.kaiser@arm.com> · 2026-05-21 11:31 UTC |
| Committer | Patryk Kaiser <patryk.kaiser@arm.com> · 2026-05-21 11:31 UTC |
| Parents | 87e5c12d12a8 |
1 file changed
modified test/common/buffer.cpp +9 −2
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // |
| 2 | -// SPDX-FileCopyrightText: Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com> | |
| 2 | +// SPDX-FileCopyrightText: Copyright 2025-2026 Arm Limited and/or its affiliates <open-source-office@arm.com> | |
| 3 | 3 | // |
| 4 | 4 | // SPDX-License-Identifier: Apache-2.0 |
| 5 | 5 | // |
| @@ -27,8 +27,15 @@ | ||
| 27 | 27 | Buffer::Buffer(const size_t size, const uint8_t init_value = 0) : m_user_buffer_size(size) { |
| 28 | 28 | KAI_ASSUME_ALWAYS_MSG(size > 0, "Buffers must be of non-zero size"); |
| 29 | 29 | |
| 30 | + // We want to default to overflow protection if supported as it is the most likely failure mode. | |
| 31 | +#if defined(__linux__) || defined(__APPLE__) | |
| 32 | + const std::string default_protect_mode = "PROTECT_OVERFLOW"; | |
| 33 | +#else // defined(__linux__) || defined(__APPLE__) | |
| 34 | + const std::string default_protect_mode = "NONE"; | |
| 35 | +#endif // defined(__linux__) || defined(__APPLE__) | |
| 36 | + | |
| 30 | 37 | const char* val = getenv(buffer_policy_env_name); |
| 31 | - const std::string buffer_policy = (val != nullptr) ? std::string(val) : std::string("NONE"); | |
| 38 | + const std::string buffer_policy = (val != nullptr) ? std::string(val) : default_protect_mode; | |
| 32 | 39 | |
| 33 | 40 | std::ostringstream oss; |
| 34 | 41 |