Skip to content

fix: crash in clipboard.readImage() on malformed image data#50475

Merged
MarshallOfSound merged 1 commit intomainfrom
sattard/fix-clipboard-readimage-null-bitmap
Mar 25, 2026
Merged

fix: crash in clipboard.readImage() on malformed image data#50475
MarshallOfSound merged 1 commit intomainfrom
sattard/fix-clipboard-readimage-null-bitmap

Conversation

@MarshallOfSound
Copy link
Copy Markdown
Member

gfx::PNGCodec::Decode() returns a null SkBitmap when it cannot decode the clipboard contents as a PNG. Passing that null bitmap to gfx::Image::CreateFrom1xBitmap() triggers a crash.

This PR adds a null check and returns an empty gfx::Image instead, matching the existing pattern in shell/common/skia_util.cc.

Notes: Fixed a crash in clipboard.readImage() when the clipboard contains malformed image data.

gfx::PNGCodec::Decode() returns a null SkBitmap when it fails to decode
the clipboard contents as a PNG. Passing that null bitmap to
gfx::Image::CreateFrom1xBitmap() triggers a crash.

Return an empty gfx::Image instead, matching the existing null-check
pattern in skia_util.cc.
@MarshallOfSound MarshallOfSound added the semver/patch backwards-compatible bug fixes label Mar 25, 2026
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 25, 2026
@MarshallOfSound MarshallOfSound added target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 25, 2026
@MarshallOfSound MarshallOfSound merged commit a48f03f into main Mar 25, 2026
84 checks passed
@MarshallOfSound MarshallOfSound deleted the sattard/fix-clipboard-readimage-null-bitmap branch March 25, 2026 17:47
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 25, 2026

Release Notes Persisted

Fixed a crash in clipboard.readImage() when the clipboard contains malformed image data.

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 25, 2026

I have automatically backported this PR to "40-x-y", please check out #50491

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 25, 2026

I have automatically backported this PR to "41-x-y", please check out #50492

@trop trop bot removed the target/40-x-y PR should also be added to the "40-x-y" branch. label Mar 25, 2026
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 25, 2026

I have automatically backported this PR to "39-x-y", please check out #50493

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 25, 2026

I have automatically backported this PR to "42-x-y", please check out #50494

@trop trop bot added in-flight/41-x-y in-flight/39-x-y in-flight/42-x-y merged/41-x-y PR was merged to the "41-x-y" branch. and removed target/41-x-y PR should also be added to the "41-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/41-x-y in-flight/39-x-y labels Mar 25, 2026
@trop trop bot added merged/39-x-y PR was merged to the "39-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. and removed in-flight/42-x-y in-flight/40-x-y labels Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/39-x-y PR was merged to the "39-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants