From: Tobias Markus Date: Mon, 23 Feb 2015 20:24:52 +0000 (+0100) Subject: Fix for coverity #29360 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0ebb40343bafd9f8b047c1917c91ab3611ded965;p=supertux.git Fix for coverity #29360 --- diff --git a/src/audio/sound_file.cpp b/src/audio/sound_file.cpp index ebe7ea3e1..834aedaf4 100644 --- a/src/audio/sound_file.cpp +++ b/src/audio/sound_file.cpp @@ -83,7 +83,12 @@ std::unique_ptr 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(new WavSoundFile(file)); else if(strncmp(magic, "OggS", 4) == 0)