Check for error when stating test input file

This commit is contained in:
Joe Ranweiler
2018-02-10 15:49:37 -08:00
parent d81cbba137
commit 579cba3705

View File

@@ -374,7 +374,9 @@ static void InitializeInputFromFile(const char *path) {
if (fd < 0) {
DeepState_Abandon("Tried to get file descriptor for invalid stream");
}
fstat(fd, &stat_buf);
if (fstat(fd, &stat_buf) < 0) {
DeepState_Abandon("Unable to access input file");
};
if (stat_buf.st_size > sizeof(DeepState_Input)) {
/* TODO(joe): Add error log with more info. */