Skip to content

Commit

Permalink
APREPRO: Clear possibly bad status of input stream
Browse files Browse the repository at this point in the history
IF using istringstream, then stream will be at end-of-string
due to being parsed; clear the bad state before seeking.
  • Loading branch information
gsjaardema committed Oct 11, 2023
1 parent d0c1aaf commit 7db7fd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/seacas/libraries/aprepro_lib/apr_scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,8 @@ namespace SEAMS {
if (len <= 0)
return;

// Clear any possible end-of-stream if e.g., reading from a istringstream.
yyin->clear();
// Go back in the stream to where we started keeping history.
yyin->seekg(hist_start);
if (!yyin->good()) {
Expand Down
2 changes: 2 additions & 0 deletions packages/seacas/libraries/aprepro_lib/aprepro.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,8 @@ integer {D}+({E})?
if (len <= 0)
return;

// Clear any possible end-of-stream if e.g., reading from a istringstream.
yyin->clear();
// Go back in the stream to where we started keeping history.
yyin->seekg(hist_start);
if (!yyin->good()) {
Expand Down

0 comments on commit 7db7fd4

Please sign in to comment.