[ion/simulator] Ignore invalid events in nws files

This commit is contained in:
Romain Goyet
2020-09-17 15:50:14 -04:00
committed by Léa Saviot
parent 7c8c7f79f6
commit 8242113641

View File

@@ -40,7 +40,10 @@ static inline bool load(FILE * f) {
int c = 0;
while ((c = getc(f)) != EOF) {
Ion::Events::Event e = Ion::Events::Event(c);
journal->pushEvent(e);
if (e.isDefined() && e.isKeyboardEvent()) {
// Avoid pushing invalid events - useful when fuzzing
journal->pushEvent(e);
}
}
Ion::Events::replayFrom(journal);