Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/codec/SkCodec.cpp

Issue 1580113002: Remove size check from SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix return statements Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/xsan.blacklist » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index f1e69be59d065acf73c28e059355345d4073da73..04ee7c6a4383736d11f738a7646a49fc9cd8b07c 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -76,30 +76,19 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream,
}
}
- SkAutoTDelete<SkCodec> codec(nullptr);
// PNG is special, since we want to be able to supply an SkPngChunkReader.
// But this code follows the same pattern as the loop.
if (SkPngCodec::IsPng(buffer, bytesRead)) {
- codec.reset(SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReader));
+ return SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReader);
} else {
for (DecoderProc proc : gDecoderProcs) {
if (proc.IsFormat(buffer, bytesRead)) {
- codec.reset(proc.NewFromStream(streamDeleter.detach()));
- break;
+ return proc.NewFromStream(streamDeleter.detach());
}
}
}
- // Set the max size at 128 megapixels (512 MB for kN32).
- // This is about 4x smaller than a test image that takes a few minutes for
- // dm to decode and draw.
- const int32_t maxSize = 1 << 27;
- if (codec && codec->getInfo().width() * codec->getInfo().height() > maxSize) {
- SkCodecPrintf("Error: Image size too large, cannot decode.\n");
- return nullptr;
- } else {
- return codec.detach();
- }
+ return nullptr;
}
SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) {
« no previous file with comments | « no previous file | tools/xsan.blacklist » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698