aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureShader.cpp
diff options
context:
space:
mode:
authorGravatar hendrikw <hendrikw@chromium.org>2015-06-16 09:28:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-16 09:28:37 -0700
commit446ee67fda73b11281b8e28a68edec811347c0c5 (patch)
treeba5be6dc7c9acb93e7d6bde7d2ac292a73712ca7 /src/core/SkPictureShader.cpp
parent0fce1fb02d93e66d42528f322f8aa4ca64ff0fb2 (diff)
skia: Add runtime option to disable picture IO security precautions
Replaced the compile time file IO security setting with a runtime setting. Unfortunately the setting is global. Review URL: https://codereview.chromium.org/1183853003
Diffstat (limited to 'src/core/SkPictureShader.cpp')
-rw-r--r--src/core/SkPictureShader.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index bbac9ed114..4b0adeb814 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);
}