Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

build(deps): update png to 0.18

ldm0ade8ace79ecf
diff --git a/Cargo.lock b/Cargo.lock
index 972d6cb58..362bc2ae7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -265,7 +265,7 @@ version = "0.72.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"cexpr",
"clang-sys",
"itertools 0.13.0",
@@ -279,12 +279,6 @@ dependencies = [
"syn 2.0.117",
]
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
[[package]]
name = "bitflags"
version = "2.11.0"
@@ -1264,7 +1258,7 @@ dependencies = [
"hashbrown 0.17.1",
"log",
"peniko",
- "png 0.18.1",
+ "png",
"skrifa 0.44.0",
"smallvec",
"vello_common",
@@ -1319,7 +1313,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d12c7c642d4ce8c2e784b4751a6634bd89583912265add4a679a8882d123fbcd"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"bytemuck",
"read-fonts 0.39.2",
"smallvec",
@@ -1331,7 +1325,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"bytemuck",
"read-fonts 0.41.0",
"smallvec",
@@ -2284,7 +2278,7 @@ dependencies = [
"image",
"jpeg-decoder",
"jpeg-encoder",
- "png 0.17.16",
+ "png",
"thiserror",
"usvg",
"xmlparser",
@@ -2391,7 +2385,7 @@ dependencies = [
name = "moli-page-types"
version = "0.1.0"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"http-auth",
"moli-cookie-jar",
"moli-dom",
@@ -2519,7 +2513,7 @@ dependencies = [
"moli-trace",
"parking_lot",
"percent-encoding",
- "png 0.17.16",
+ "png",
"serde_json",
"socket2",
"time",
@@ -2622,7 +2616,7 @@ dependencies = [
"moli-xpath",
"parking_lot",
"percent-encoding",
- "png 0.17.16",
+ "png",
"precomputed-hash",
"publicsuffix",
"selectors",
@@ -3078,7 +3072,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
]
[[package]]
@@ -3087,7 +3081,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"objc2-core-foundation",
]
@@ -3103,7 +3097,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"objc2",
]
@@ -3125,7 +3119,7 @@ version = "0.10.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a45fa2aa886c42762255da344f0a0d313e254066c46aad76f300c3d3da62d967"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"cfg-if",
"foreign-types",
"libc",
@@ -3222,7 +3216,7 @@ version = "0.127.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "381ae8356082431bd7e217dd78c7179bfc379dbbe7a32494e28be4fc678812c7"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"oxc_allocator",
"oxc_ast_macros",
"oxc_data_structures",
@@ -3313,7 +3307,7 @@ version = "0.127.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71acdb67749ff68bfbbd346da7dd2fe4947964be49ac9ec34d73d10a2396dcd"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"cow-utils",
"memchr",
"num-bigint",
@@ -3337,7 +3331,7 @@ version = "0.127.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08a1273168ec6d8083e161565d264847249b9aad51c430d92d344303ede058b2"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"oxc_allocator",
"oxc_ast_macros",
"oxc_diagnostics",
@@ -3380,7 +3374,7 @@ version = "0.127.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b448a086623714675f66b79271e25fa2b51708255fa6af7dad83be88cc6e8726"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"cow-utils",
"dragonbox_ecma",
"nonmax",
@@ -3590,26 +3584,13 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
-[[package]]
-name = "png"
-version = "0.17.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
-dependencies = [
- "bitflags 1.3.2",
- "crc32fast",
- "fdeflate",
- "flate2",
- "miniz_oxide",
-]
-
[[package]]
name = "png"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"crc32fast",
"fdeflate",
"flate2",
@@ -3828,7 +3809,7 @@ version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
]
[[package]]
@@ -3920,7 +3901,7 @@ version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"errno",
"libc",
"linux-raw-sys",
@@ -4013,7 +3994,7 @@ name = "selectors"
version = "0.40.0"
source = "git+https://github.com/ldm0/stylo?rev=74cd014af14d84db1fc8faed85086895012fc687#74cd014af14d84db1fc8faed85086895012fc687"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"cssparser",
"derive_more",
"log",
@@ -4392,7 +4373,7 @@ dependencies = [
"app_units",
"arrayvec",
"atomic_refcell",
- "bitflags 2.11.0",
+ "bitflags",
"byteorder",
"cssparser",
"derive_more",
@@ -4466,7 +4447,7 @@ name = "stylo_dom"
version = "0.20.0"
source = "git+https://github.com/ldm0/stylo?rev=74cd014af14d84db1fc8faed85086895012fc687#74cd014af14d84db1fc8faed85086895012fc687"
dependencies = [
- "bitflags 2.11.0",
+ "bitflags",
"stylo_malloc_size_of",
]
@@ -4511,7 +4492,7 @@ version = "0.20.0"
source = "git+https://github.com/ldm0/stylo?rev=74cd014af14d84db1fc8faed85086895012fc687#74cd014af14d84db1fc8faed85086895012fc687"
dependencies = [
"app_units",
- "bitflags 2.11.0",
+ "bitflags",
"cssparser",
"euclid",
"malloc_size_of_derive",
@@ -5238,7 +5219,7 @@ name = "v8"
version = "146.9.0"
dependencies = [
"bindgen",
- "bitflags 2.11.0",
+ "bitflags",
"cc",
"fslock",
"gzip-header",
@@ -5272,7 +5253,7 @@ dependencies = [
"guillotiere",
"log",
"peniko",
- "png 0.18.1",
+ "png",
"smallvec",
"thiserror",
]
@@ -5286,7 +5267,7 @@ dependencies = [
"bytemuck",
"glifo",
"hashbrown 0.17.1",
- "png 0.18.1",
+ "png",
"vello_common",
]
diff --git a/moli-image/Cargo.toml b/moli-image/Cargo.toml
index 4a6206a47..cc0dd7e41 100644
--- a/moli-image/Cargo.toml
+++ b/moli-image/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
image = { version = "0.25.10", default-features = false, features = ["gif", "webp"] }
jpeg-decoder = "0.3"
jpeg-encoder = "0.6"
-png = "0.17"
+png = "0.18"
thiserror = "2.0.17"
usvg = { version = "=0.48.1", default-features = true }
xmlparser = "0.13.6"
diff --git a/moli-image/src/png.rs b/moli-image/src/png.rs
index efdf7a27a..c0158fcd8 100644
--- a/moli-image/src/png.rs
+++ b/moli-image/src/png.rs
@@ -86,7 +86,7 @@ pub fn encode_png_rgba8_with_options(
encoder.set_depth(png::BitDepth::Eight);
if options.optimize_for_speed {
encoder.set_compression(png::Compression::Fast);
- encoder.set_filter(png::FilterType::NoFilter);
+ encoder.set_filter(png::Filter::NoFilter);
}
let mut writer = encoder.write_header()?;
writer.write_image_data(rgba)?;
@@ -117,8 +117,12 @@ pub fn decode_png(bytes: &[u8]) -> Result<RgbaImage, PngDecodeError> {
);
decoder.set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16);
let mut reader = decoder.read_info()?;
- checked_rgba_len(reader.info().width, reader.info().height)?;
- let mut decoded = vec![0; reader.output_buffer_size()];
+ let (width, height) = (reader.info().width, reader.info().height);
+ checked_rgba_len(width, height)?;
+ let output_buffer_size = reader
+ .output_buffer_size()
+ .ok_or(RgbaImageError::BufferLengthOverflow { width, height })?;
+ let mut decoded = vec![0; output_buffer_size];
let output = reader.next_frame(&mut decoded)?;
decoded.truncate(output.buffer_size());
diff --git a/moli-protocol-server/Cargo.toml b/moli-protocol-server/Cargo.toml
index caea92bef..e60a1e04d 100644
--- a/moli-protocol-server/Cargo.toml
+++ b/moli-protocol-server/Cargo.toml
@@ -31,7 +31,7 @@ url = "2.5.7"
moli-browser-profile = { path = "../moli-browser-profile" }
moli-cookie-cache = { path = "../moli-cookie-cache" }
moli-protocol = { path = "../moli-protocol", features = ["test-support"] }
-png = "0.17"
+png = "0.18"
time = "0.3"
tokio-tungstenite = { version = "0.28.0", features = ["rustls-tls-webpki-roots"] }
tower = { version = "0.5.2", features = ["util"] }
diff --git a/moli-protocol-server/src/protocol_server/tests/screenshot.rs b/moli-protocol-server/src/protocol_server/tests/screenshot.rs
index e45566a28..08c5b0aa0 100644
--- a/moli-protocol-server/src/protocol_server/tests/screenshot.rs
+++ b/moli-protocol-server/src/protocol_server/tests/screenshot.rs
@@ -136,7 +136,12 @@ fn decode_png(bytes: &[u8]) -> (u32, u32, Vec<u8>) {
assert_eq!(&bytes[..8], b"\x89PNG\r\n\x1a\n");
let decoder = png::Decoder::new(Cursor::new(bytes));
let mut reader = decoder.read_info().expect("valid PNG header");
- let mut buffer = vec![0; reader.output_buffer_size()];
+ let mut buffer = vec![
+ 0;
+ reader
+ .output_buffer_size()
+ .expect("decoded PNG buffer size fits in memory")
+ ];
let output = reader.next_frame(&mut buffer).expect("valid PNG data");
assert_eq!(output.color_type, png::ColorType::Rgba);
assert_eq!(output.bit_depth, png::BitDepth::Eight);
diff --git a/moli-renderer-v8/Cargo.toml b/moli-renderer-v8/Cargo.toml
index b1270d972..e814829d5 100644
--- a/moli-renderer-v8/Cargo.toml
+++ b/moli-renderer-v8/Cargo.toml
@@ -110,7 +110,7 @@ moli-fetch = { path = "../moli-fetch", features = ["test-support"] }
moli-page-types = { path = "../moli-page-types", features = ["test-support"] }
moli-v8-test-util = { path = "../moli-v8-test-util" }
moli-websocket = { path = "../moli-websocket", features = ["test-support"] }
-png = "0.17"
+png = "0.18"
wuff = "=0.2.5"
[lints]
diff --git a/moli-renderer-v8/src/runtime/tests.rs b/moli-renderer-v8/src/runtime/tests.rs
index 94d723c55..e2a08045e 100644
--- a/moli-renderer-v8/src/runtime/tests.rs
+++ b/moli-renderer-v8/src/runtime/tests.rs
@@ -1038,7 +1038,12 @@ async fn capture_screenshot_with_request(
fn decoded_png_pixel(bytes: &[u8], x: u32, y: u32) -> [u8; 4] {
let decoder = png::Decoder::new(Cursor::new(bytes));
let mut reader = decoder.read_info().expect("valid PNG header");
- let mut buffer = vec![0; reader.output_buffer_size()];
+ let mut buffer = vec![
+ 0;
+ reader
+ .output_buffer_size()
+ .expect("decoded PNG buffer size fits in memory")
+ ];
let output = reader.next_frame(&mut buffer).expect("valid PNG data");
assert_eq!(output.color_type, png::ColorType::Rgba);
assert_eq!(output.bit_depth, png::BitDepth::Eight);
@@ -1057,7 +1062,12 @@ fn decoded_png_dark_pixel_count(
) -> usize {
let decoder = png::Decoder::new(Cursor::new(bytes));
let mut reader = decoder.read_info().expect("valid PNG header");
- let mut buffer = vec![0; reader.output_buffer_size()];
+ let mut buffer = vec![
+ 0;
+ reader
+ .output_buffer_size()
+ .expect("decoded PNG buffer size fits in memory")
+ ];
let output = reader.next_frame(&mut buffer).expect("valid PNG data");
assert_eq!(output.color_type, png::ColorType::Rgba);
assert_eq!(output.bit_depth, png::BitDepth::Eight);