Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
electron
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
ExcellentOSS
electron
Commits
975da07b
Unverified
Commit
975da07b
authored
8 months ago
by
trop[bot]
Committed by
GitHub
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
chore: add a DCHECK to confirm the BigBuffer is full
Co-authored-by:
Charles Kerr
<
charles@charleskerr.com
>
parent
8c96b2b7
Branches
trop/33-x-y-bp-fix-wunsafe-buffer-usage-warnings-in-clipboard-writebuffer--1726805444410
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shell/common/api/electron_api_clipboard.cc
+4
-2
4 additions, 2 deletions
shell/common/api/electron_api_clipboard.cc
with
4 additions
and
2 deletions
shell/common/api/electron_api_clipboard.cc
+
4
−
2
View file @
975da07b
...
...
@@ -114,8 +114,10 @@ void Clipboard::WriteBuffer(const std::string& format,
CHECK
(
buffer
->
IsArrayBufferView
());
v8
::
Local
<
v8
::
ArrayBufferView
>
buffer_view
=
buffer
.
As
<
v8
::
ArrayBufferView
>
();
const
size_t
n_bytes
=
buffer_view
->
ByteLength
();
mojo_base
::
BigBuffer
big_buffer
(
n_bytes
);
buffer_view
->
CopyContents
(
big_buffer
.
data
(),
n_bytes
);
mojo_base
::
BigBuffer
big_buffer
{
n_bytes
};
[[
maybe_unused
]]
const
size_t
n_got
=
buffer_view
->
CopyContents
(
big_buffer
.
data
(),
n_bytes
);
DCHECK_EQ
(
n_got
,
n_bytes
);
ui
::
ScopedClipboardWriter
writer
(
GetClipboardBuffer
(
args
));
writer
.
WriteUnsafeRawData
(
base
::
UTF8ToUTF16
(
format
),
std
::
move
(
big_buffer
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment