[flang-commits] [flang] [flang][unittests] Fix buffer underrun in LengthWithoutTrailingSpaces (PR #84382)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Mar 11 08:14:44 PDT 2024
================
@@ -196,11 +196,14 @@ std::int32_t RTNAME(GetCommand)(const Descriptor *value,
}
static std::size_t LengthWithoutTrailingSpaces(const Descriptor &d) {
- std::size_t s{d.ElementBytes() - 1};
- while (*d.OffsetElement(s) == ' ') {
+ std::size_t s{d.ElementBytes()}; // This can be 0.
+ if (s == 0) {
----------------
klausler wrote:
This `if` statement is unnecessary.
https://github.com/llvm/llvm-project/pull/84382
More information about the flang-commits
mailing list