Skip to content

Commit 7463b46

Browse files
authored
[flang][runtime] Fix use of empty optional in BOZ input (#120789)
Slava reported a valgrind result showing the use of uninitialized data due to an unconditional dereference of an optional in BOZ formatted input editing; fix.
1 parent b8513e4 commit 7463b46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang/runtime/edit-input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static RT_API_ATTRS bool EditBOZInput(
130130
shift = shift - 8; // misaligned octal
131131
}
132132
while (digits > 0) {
133-
char32_t ch{*io.NextInField(remaining, edit)};
133+
char32_t ch{io.NextInField(remaining, edit).value_or(' ')};
134134
int digit{0};
135135
if (ch == ' ' || ch == '\t') {
136136
if (edit.modes.editingFlags & blankZero) {

0 commit comments

Comments
 (0)