mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-01 22:17:53 -06:00
Merge PR #3015: Never crash: an oversize export size is an error, not a multiply overflow
crates/engine/src/media.rs: main moved render_now and export_job to media/session.rs; the two size checks ported there crates/engine/src/tests_export.rs: the test is appended to tests/export.rs
This commit is contained in:
@@ -599,7 +599,10 @@ pub fn render(
|
||||
};
|
||||
let plan = lightcraft_pipeline::plan(src, info, s, req);
|
||||
let (w, h) = (plan.w, plan.h);
|
||||
let n = w * h;
|
||||
let Some(n) = w.checked_mul(h).filter(|n| n.checked_mul(12).is_some()) else {
|
||||
fail(FailKind::Limit, format!("{w}×{h} output is too large"));
|
||||
return None;
|
||||
};
|
||||
let _limit = match fault {
|
||||
Some(crate::Fault::Limit(bytes)) => Some(crate::ctx::LimitOverride::new(bytes)),
|
||||
_ => None,
|
||||
|
||||
Reference in New Issue
Block a user