From 0f44062d7b03dde85a13fe6929c52bb84d31fef3 Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Mon, 15 Sep 2025 17:02:19 -0700 Subject: [PATCH] [flang][runtime] Block bad left tabbing in child I/O Child I/O subroutines are not supposed to use T or TL control edit descriptors in formats to move the position in the current record to a point before where it stood at the time of their calls (F'2023 12.6.4.8.3 paragraph 18), but we should also guard against attempts to do so, using the same means used to prevent such attempts in non-advancing I/O. Fixes https://github.com/llvm/llvm-project/issues/158723. --- flang-rt/lib/runtime/unit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/flang-rt/lib/runtime/unit.cpp b/flang-rt/lib/runtime/unit.cpp index da3783417f234..549fbeaca05b3 100644 --- a/flang-rt/lib/runtime/unit.cpp +++ b/flang-rt/lib/runtime/unit.cpp @@ -827,6 +827,7 @@ ChildIo &ExternalFileUnit::PushChildIo(IoStatementState &parent) { Terminator &terminator{parent.GetIoErrorHandler()}; OwningPtr next{New{terminator}(parent, std::move(current))}; child_.reset(next.release()); + leftTabLimit = positionInRecord; return *child_; }