diff options
author | Colin Snover | 2016-12-31 20:39:57 -0600 |
---|---|---|
committer | Colin Snover | 2017-03-27 19:42:31 -0500 |
commit | 31daa956d62b39429cb6638ed3fb549ac488833a (patch) | |
tree | fa831adefae05d82209b3f565055f7b761ca8691 /engines/sci/resource.h | |
parent | 1298762b7665dc1b7aeedf0271eadfb284309ef1 (diff) | |
download | scummvm-rg350-31daa956d62b39429cb6638ed3fb549ac488833a.tar.gz scummvm-rg350-31daa956d62b39429cb6638ed3fb549ac488833a.tar.bz2 scummvm-rg350-31daa956d62b39429cb6638ed3fb549ac488833a.zip |
SCI: Implement bounds-checked reads of game resources
Diffstat (limited to 'engines/sci/resource.h')
-rw-r--r-- | engines/sci/resource.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 5589129553..a9a7a86c96 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -30,6 +30,7 @@ #include "sci/graphics/helpers.h" // for ViewType #include "sci/decompressor.h" #include "sci/sci.h" +#include "sci/util.h" namespace Common { class File; @@ -226,7 +227,7 @@ struct ResourceIdHash : public Common::UnaryFunction<ResourceId, uint> { }; /** Class for storing resources in memory */ -class Resource { +class Resource : public SciSpan<const byte> { friend class ResourceManager; // FIXME: These 'friend' declarations are meant to be a temporary hack to @@ -243,8 +244,6 @@ class Resource { // NOTE : Currently most member variables lack the underscore prefix and have // public visibility to let the rest of the engine compile without changes. public: - byte *data; - uint32 size; byte *_header; uint32 _headerSize; @@ -595,11 +594,21 @@ public: byte flags; byte poly; uint16 prio; - uint16 size; - byte *data; + SciSpan<const byte> data; uint16 curPos; long time; byte prev; + + Channel() : + number(0), + flags(0), + poly(0), + prio(0), + data(), + curPos(0) { + time = 0; + prev = 0; + } }; struct Track { |