diff options
author | rubidium <rubidium@openttd.org> | 2013-11-23 13:17:45 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-11-23 13:17:45 +0000 |
commit | 78a316d349f02c76b89c6fd7597e7013c062133a (patch) | |
tree | f9ed8c8d687f7081d6de04c70a82060d4ed2f040 /src/newgrf_config.cpp | |
parent | 29ef70c246293ebde72f36e0a01483eeac6f7fdf (diff) | |
download | openttd-78a316d349f02c76b89c6fd7597e7013c062133a.tar.xz |
(svn r26061) -Fix: negative result of ftell wasn't handled correctly in some cases
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r-- | src/newgrf_config.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index bbd670a71..df8685030 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -360,10 +360,10 @@ static bool CalcGRFMD5Sum(GRFConfig *config, Subdirectory subdir) f = FioFOpenFile(config->filename, "rb", subdir, &size); if (f == NULL) return false; - size_t start = ftell(f); + long start = ftell(f); size = min(size, GRFGetSizeOfDataSection(f)); - if (fseek(f, start, SEEK_SET) < 0) { + if (start < 0 || fseek(f, start, SEEK_SET) < 0) { FioFCloseFile(f); return false; } |