Author: post
Date: 2010-11-28 17:04:40 +0100 (Sun, 28 Nov 2010)
New Revision: 308
Modified:
RawSpeed/FileReader.cpp
Log:
Add further checks when opening file.
Modified: RawSpeed/FileReader.cpp
===================================================================
--- RawSpeed/FileReader.cpp 2010-11-25 20:48:43 UTC (rev 307)
+++ RawSpeed/FileReader.cpp 2010-11-28 16:04:40 UTC (rev 308)
@@ -41,7 +41,11 @@
int fd;
char *dest;
- stat(mFilename, &st);
+ if (stat(mFilename, &st) < 0)
+ throw FileIOException("Could not read size of file (check
permissions)");
+ if (st.st_size == 0)
+ throw FileIOException("File is 0 bytes.");
+
fd = open(mFilename, O_RDONLY);
if (fd < 0)
throw FileIOException("Could not open file.");
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit