Pictures: refuse a header that claims too many pixels, before decoding
The first fuzz run on cnx01 found it: a drawn signature of 798 bytes whose PNG header says 300 x 738,197,594 pixels made krilla ask for 885 GB. A failed allocation aborts the process, so one such signature on any client link (or such an upload in a pack) would have ended the app for everyone; reproduced on a normal build, with a valid IHDR checksum. krilla decodes a picture as soon as it makes it, so papers::pixels reads the size from the header first, with the decoder krilla uses (png, zune-jpeg, image-webp; already in Cargo.lock, now direct dependencies), and papers::picture refuses more than MAX_PIXELS (50 megapixels, about 200 MB decoded) before krilla sees the file. The pack and the Documents tab print a note for such a file, the signed copy refuses it, and the client page refuses the signature (422, "did not arrive whole") before anything is stored. tests/fuzz_cases/signed_copy/png-claims-885-gigabytes is the finding, replayed on every push; unit tests for the header sizes and the limit, and the agreements test sends the forged signature.
This commit is contained in:
1 parent
9b4d73c94b
commit
b7c9818dd6
9 files changed
+133
-12
No files matched your search
Generated
+3
@@ -2724,9 +2724,11 @@ dependencies = [
|
||||
"chrono",
|
||||
"form_urlencoded",
|
||||
"http-body-util",
|
||||
"image-webp",
|
||||
"krilla",
|
||||
"lettre",
|
||||
"minijinja",
|
||||
"png",
|
||||
"proptest",
|
||||
"qrcode",
|
||||
"reqwest",
|
||||
@@ -2740,6 +2742,7 @@ dependencies = [
|
||||
"tower",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"zune-jpeg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in new issue
Block a user