aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <machine.sanctum@gmail.com>2014-12-22 17:17:32 +0100
committerMartijn Kaijser <machine.sanctum@gmail.com>2014-12-22 17:17:32 +0100
commitf19c2b5a845d86a34eca6f68336b7acecdff9332 (patch)
treed1d81a7ac93a38e66b96efc50c7452dcb1f9de5f
parent33c4063cc27695292491d2447d629182484ac653 (diff)
parent811d6936163c8ddfde64576d60cf24ba0d31a55c (diff)
Merge pull request #6008 from fritsch/vfs-helix
CFile: Don't cast potential negative values to unsigned int
-rw-r--r--xbmc/filesystem/File.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp
index c25667d320..5156284542 100644
--- a/xbmc/filesystem/File.cpp
+++ b/xbmc/filesystem/File.cpp
@@ -1034,10 +1034,15 @@ CFileStreamBuffer::int_type CFileStreamBuffer::underflow()
memmove(m_buffer, egptr()-backsize, backsize);
}
- unsigned int size = m_file->Read(m_buffer+backsize, m_frontsize);
+ ssize_t size = m_file->Read(m_buffer+backsize, m_frontsize);
- if(size == 0)
+ if (size == 0)
return traits_type::eof();
+ else if (size < 0)
+ {
+ CLog::LogF(LOGWARNING, "Error reading file - assuming eof");
+ return traits_type::eof();
+ }
setg(m_buffer, m_buffer+backsize, m_buffer+backsize+size);
return traits_type::to_int_type(*gptr());