summaryrefslogtreecommitdiff
path: root/ext/canvas/lib.rs
diff options
context:
space:
mode:
authorHajime-san <41257923+Hajime-san@users.noreply.github.com>2024-05-07 20:47:42 +0900
committerGitHub <noreply@github.com>2024-05-07 04:47:42 -0700
commite7a2317f5a18751ecc1a63b3464690b125839ecf (patch)
tree505bb7762e5b77ca43c71804e9af5503c1ba6edb /ext/canvas/lib.rs
parentcbb78e138ffbfc92ca64f2cce56dd5c629e4f142 (diff)
fix(ext/web): properly handle `Blob` case for `createImageBitmap` (#23518)
fixes https://github.com/denoland/deno/issues/22649
Diffstat (limited to 'ext/canvas/lib.rs')
-rw-r--r--ext/canvas/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/canvas/lib.rs b/ext/canvas/lib.rs
index b05332c3f..72173f133 100644
--- a/ext/canvas/lib.rs
+++ b/ext/canvas/lib.rs
@@ -130,7 +130,8 @@ fn op_image_decode_png(#[buffer] buf: &[u8]) -> Result<DecodedPng, AnyError> {
)));
}
- let mut png_data = Vec::with_capacity(png.total_bytes() as usize);
+ // read_image will assert that the buffer is the correct size, so we need to fill it with zeros
+ let mut png_data = vec![0_u8; png.total_bytes() as usize];
png.read_image(&mut png_data)?;