projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1b11867
)
Fix for coverity #29360
author
Tobias Markus
<tobbi@mozilla-uk.org>
Mon, 23 Feb 2015 20:24:52 +0000
(21:24 +0100)
committer
Tobias Markus
<tobbi@mozilla-uk.org>
Mon, 23 Feb 2015 20:24:52 +0000
(21:24 +0100)
src/audio/sound_file.cpp
patch
|
blob
|
history
diff --git
a/src/audio/sound_file.cpp
b/src/audio/sound_file.cpp
index
ebe7ea3
..
834aeda
100644
(file)
--- a/
src/audio/sound_file.cpp
+++ b/
src/audio/sound_file.cpp
@@
-83,7
+83,12
@@
std::unique_ptr<SoundFile> load_sound_file(const std::string& filename)
char magic[4];
if(PHYSFS_read(file, magic, sizeof(magic), 1) != 1)
throw SoundError("Couldn't read magic, file too short");
- PHYSFS_seek(file, 0);
+ if (PHYSFS_seek(file, 0) == 0) {
+ std::stringstream msg;
+ msg << "Couldn't seek through sound file: " << PHYSFS_getLastError();
+ throw SoundError(msg.str());
+ }
+
if(strncmp(magic, "RIFF", 4) == 0)
return std::unique_ptr<SoundFile>(new WavSoundFile(file));
else if(strncmp(magic, "OggS", 4) == 0)