-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_aiger: Fix incorrect read of binary Aiger without outputs #4359
Conversation
frontends/aiger/aigerparse.cc
Outdated
@@ -722,7 +722,8 @@ void AigerReader::parse_aiger_binary() | |||
module->connect(wire, createWireIfNotExists(module, l1)); | |||
outputs.push_back(wire); | |||
} | |||
std::getline(f, line); // Ignore up to start of next line | |||
if (O > 0) | |||
std::getline(f, line); // Ignore up to start of next line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Please move up the getline below f >> l1
so we consume the full line per every output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sure I can do that, will do the same for the following if (B > 0)
and the ascii parser while im at it
8e20c64
to
69e6caa
Compare
tests/aiger/and_bad.aag
Outdated
@@ -0,0 +1,8 @@ | |||
aag 3 2 0 0 1 1 0 0 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a malformed aiger file? What do the tests do with it then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah in hindsight i did not give that file a very good name. its just an aiger file that has a bad state node instead of an output node (so would have caused the issue that this pr fixes). it is a valid aiger file though. will rename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah please do other than that the PR looks good
* Also makes all ascii parsing finish reading lines and adds a small test
69e6caa
to
4e6deb5
Compare
This was unconditionally reading the rest of a line when parsing outputs, but if none exist that means an extra line is parsed. This causes the following bad state parsing to fail with the error "Line %u cannot be interpreted as a bad state property!" on a file with only bad state properties and no outputs
Fix does the same as the similar check in Line 738 to only finish reading the line if any outputs have been read.