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

Unified Diff: src/core/SkPictureShader.cpp

Issue 1183853003: skia: Add runtime option to disable picture IO security precautions (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rename stuff Created 5 years, 6 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 | « src/core/SkPicture.cpp ('k') | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureShader.cpp
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index bbac9ed1146b32f0074caa86316c42eb5d1b83af..4b0adeb8140a54b91e5820d979279b624ba28fc7 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -123,8 +123,6 @@ SkShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMo
return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile));
}
-// TODO: rename SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS to SK_DISALLOW_CROSSPROCESS_PICTURES
-
SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
SkMatrix lm;
buffer.readMatrix(&lm);
@@ -134,8 +132,8 @@ SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
buffer.readRect(&tile);
SkAutoTUnref<SkPicture> picture;
-#ifdef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS
- if (buffer.isCrossProcess()) {
+
+ if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnabled()) {
if (buffer.isVersionLT(SkReadBuffer::kPictureShaderHasPictureBool_Version)) {
// Older code blindly serialized pictures. We don't trust them.
buffer.validate(false);
@@ -144,9 +142,7 @@ SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
// Newer code won't serialize pictures in disallow-cross-process-picture mode.
// Assert that they didn't serialize anything except a false here.
buffer.validate(!buffer.readBool());
- } else
-#endif
- {
+ } else {
// Old code always serialized the picture. New code writes a 'true' first if it did.
if (buffer.isVersionLT(SkReadBuffer::kPictureShaderHasPictureBool_Version) ||
buffer.readBool()) {
@@ -162,14 +158,11 @@ void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
buffer.write32(fTmy);
buffer.writeRect(fTile);
-#ifdef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS
// The deserialization code won't trust that our serialized picture is safe to deserialize.
// So write a 'false' telling it that we're not serializing a picture.
- if (buffer.isCrossProcess()) {
+ if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnabled()) {
buffer.writeBool(false);
- } else
-#endif
- {
+ } else {
buffer.writeBool(true);
fPicture->flatten(buffer);
}
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698