[Scummvm-git-logs] scummvm master -> 4aa3d35d77f3d8510f44004770530cdf50ad5650

athrxx athrxx at scummvm.org
Mon Nov 9 21:57:16 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4aa3d35d77 KYRA: Add a sanity test for aud files (#2614)


Commit: 4aa3d35d77f3d8510f44004770530cdf50ad5650
    https://github.com/scummvm/scummvm/commit/4aa3d35d77f3d8510f44004770530cdf50ad5650
Author: Vladimir Serbinenko (phcoder at google.com)
Date: 2020-11-09T22:57:13+01:00

Commit Message:
KYRA: Add a sanity test for aud files (#2614)

Russian translation dumbs out aud files, so don't attempt to read them

Changed paths:
    engines/kyra/resource/resource_intern.cpp
    engines/kyra/sound/drivers/audstream.cpp


diff --git a/engines/kyra/resource/resource_intern.cpp b/engines/kyra/resource/resource_intern.cpp
index c32de44bc2..7fdfd178b6 100644
--- a/engines/kyra/resource/resource_intern.cpp
+++ b/engines/kyra/resource/resource_intern.cpp
@@ -241,7 +241,7 @@ Common::String readString(Common::SeekableReadStream &stream) {
 
 bool ResLoaderPak::isLoadable(const Common::String &filename, Common::SeekableReadStream &stream) const {
 	int32 filesize = stream.size();
-	if (filesize < 0)
+	if (filesize < 4)
 		return false;
 
 	int32 offset = 0;
@@ -287,7 +287,7 @@ bool ResLoaderPak::isLoadable(const Common::String &filename, Common::SeekableRe
 
 Common::Archive *ResLoaderPak::load(Common::ArchiveMemberPtr memberFile, Common::SeekableReadStream &stream) const {
 	int32 filesize = stream.size();
-	if (filesize < 0)
+	if (filesize < 4)
 		return 0;
 
 	Common::ScopedPtr<PlainArchive> result(new PlainArchive(memberFile));
@@ -450,6 +450,8 @@ bool ResLoaderTlk::checkFilename(Common::String filename) const {
 }
 
 bool ResLoaderTlk::isLoadable(const Common::String &filename, Common::SeekableReadStream &stream) const {
+	if (stream.size() < 2)
+		return false;
 	uint16 entries = stream.readUint16LE();
 	int32 entryTableSize = (entries * 8);
 
diff --git a/engines/kyra/sound/drivers/audstream.cpp b/engines/kyra/sound/drivers/audstream.cpp
index 1cc586f64c..fe026154a7 100644
--- a/engines/kyra/sound/drivers/audstream.cpp
+++ b/engines/kyra/sound/drivers/audstream.cpp
@@ -80,6 +80,11 @@ AUDStream::AUDStream(Common::SeekableReadStream *stream) : _stream(stream), _end
 	_processedSize(0), _totalSize(0), _length(0, 1), _bytesLeft(0), _outBuffer(0),
 	_outBufferOffset(0), _outBufferSize(0), _inBuffer(0), _inBufferSize(0) {
 
+	if (_stream->size() < 8) {
+		warning("No AUD file: too short");
+		return;
+	}
+
 	_rate = _stream->readUint16LE();
 	_totalSize = _stream->readUint32LE();
 




More information about the Scummvm-git-logs mailing list