Skip to content

Commit

Permalink
Bug 1836550 - Validate image data received from IPC; r=NeilDeakin, a=…
Browse files Browse the repository at this point in the history
…dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D181261
  • Loading branch information
EdgarChen committed Jun 20, 2023
1 parent 1a7c0eb commit 4825259
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dom/ipc/BrowserParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3838,10 +3838,14 @@ mozilla::ipc::IPCResult BrowserParent::RecvInvokeDragSession(
cookieJarSettings, aSourceWindowContext.GetMaybeDiscarded(),
aSourceTopWindowContext.GetMaybeDiscarded());

if (aVisualDnDData && aVisualDnDData->Size() >= aDragRect.height * aStride) {
dragStartData->SetVisualization(gfx::CreateDataSourceSurfaceFromData(
gfx::IntSize(aDragRect.width, aDragRect.height), aFormat,
aVisualDnDData->Data(), aStride));
if (aVisualDnDData) {
const auto checkedSize = CheckedInt<size_t>(aDragRect.height) * aStride;
if (checkedSize.isValid() &&
aVisualDnDData->Size() >= checkedSize.value()) {
dragStartData->SetVisualization(gfx::CreateDataSourceSurfaceFromData(
gfx::IntSize(aDragRect.width, aDragRect.height), aFormat,
aVisualDnDData->Data(), aStride));
}
}

nsCOMPtr<nsIDragService> dragService =
Expand Down

0 comments on commit 4825259

Please sign in to comment.