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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp

Issue 1739613002: DevTools: validate protocol input parameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 25cd3d316f7e5ea559f2fb5bfefc55b9134fd17d..3cf74820dc296ec8c453d26389f516425852fb02 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -350,15 +350,7 @@ void InspectorLayerTreeAgent::loadSnapshot(ErrorString* errorString, PassOwnPtr<
Vector<RefPtr<PictureSnapshot::TilePictureStream>> decodedTiles;
decodedTiles.grow(tiles->length());
for (size_t i = 0; i < tiles->length(); ++i) {
- OwnPtr<protocol::LayerTree::PictureTile> tile = tiles->get(i);
- if (!tile) {
- *errorString = "Invalid argument, array item is not an object";
- return;
- }
- if (!tile->hasX() || !tile->hasY() || !tile->hasPicture()) {
- *errorString = "Invalid argument, missing required field";
- return;
- }
+ protocol::LayerTree::PictureTile* tile = tiles->get(i);
decodedTiles[i] = adoptRef(new PictureSnapshot::TilePictureStream());
decodedTiles[i]->layerOffset.set(tile->getX(), tile->getY());
if (!base64Decode(tile->getPicture(), decodedTiles[i]->data)) {
@@ -420,8 +412,6 @@ void InspectorLayerTreeAgent::replaySnapshot(ErrorString* errorString, const Str
static bool parseRect(protocol::DOM::Rect* object, FloatRect* rect)
{
- if (!object->hasX() || !object->hasY() || !object->hasWidth() || !object->hasHeight())
- return false;
*rect = FloatRect(object->getX(), object->getY(), object->getWidth(), object->getHeight());
return true;
}
@@ -452,7 +442,8 @@ void InspectorLayerTreeAgent::snapshotCommandLog(ErrorString* errorString, const
const PictureSnapshot* snapshot = snapshotById(errorString, snapshotId);
if (!snapshot)
return;
- *commandLog = Array<RefPtr<JSONObject>>::runtimeCast(snapshot->snapshotCommandLog());
+ protocol::ErrorSupport errors(errorString);
+ *commandLog = Array<RefPtr<JSONObject>>::parse(snapshot->snapshotCommandLog(), &errors);
}
void InspectorLayerTreeAgent::willAddPageOverlay(const GraphicsLayer* layer)

Powered by Google App Engine
This is Rietveld 408576698