aboutsummaryrefslogtreecommitdiff
path: root/image/png.cpp
diff options
context:
space:
mode:
authoryinsimei2017-07-01 13:41:42 +0200
committerEugene Sandulenko2017-07-13 18:27:45 +0200
commit1a27d671233cea7cb5cc25a1ff2a905260116398 (patch)
tree24689f2c6733d033e938deb5f296a3c3620ea5e5 /image/png.cpp
parent5469aaf8ec48050b517933f69c6b2bcbbc288c0f (diff)
downloadscummvm-rg350-1a27d671233cea7cb5cc25a1ff2a905260116398.tar.gz
scummvm-rg350-1a27d671233cea7cb5cc25a1ff2a905260116398.tar.bz2
scummvm-rg350-1a27d671233cea7cb5cc25a1ff2a905260116398.zip
IMAGE: add flag to skip signature check in png decoder
Diffstat (limited to 'image/png.cpp')
-rw-r--r--image/png.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/image/png.cpp b/image/png.cpp
index 37617a1690..e11f0459d2 100644
--- a/image/png.cpp
+++ b/image/png.cpp
@@ -39,7 +39,7 @@
namespace Image {
-PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0) {
+PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0), _skipSignature(false) {
}
PNGDecoder::~PNGDecoder() {
@@ -99,12 +99,14 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) {
#ifdef USE_PNG
destroy();
- // First, check the PNG signature
- if (stream.readUint32BE() != MKTAG(0x89, 'P', 'N', 'G')) {
- return false;
- }
- if (stream.readUint32BE() != MKTAG(0x0d, 0x0a, 0x1a, 0x0a)) {
- return false;
+ // First, check the PNG signature (if not set to skip it)
+ if (!_skipSignature) {
+ if (stream.readUint32BE() != MKTAG(0x89, 'P', 'N', 'G')) {
+ return false;
+ }
+ if (stream.readUint32BE() != MKTAG(0x0d, 0x0a, 0x1a, 0x0a)) {
+ return false;
+ }
}
// The following is based on the guide provided in: