From 579cba3705dedc9f4dcd315dd610353d80a7fc00 Mon Sep 17 00:00:00 2001 From: Joe Ranweiler Date: Sat, 10 Feb 2018 15:49:37 -0800 Subject: [PATCH] Check for error when stating test input file --- src/include/deepstate/DeepState.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index afac5ad..eb99bcb 100644 --- a/src/include/deepstate/DeepState.h +++ b/src/include/deepstate/DeepState.h @@ -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. */