MCPcopy Create free account
hub / github.com/ImageOptim/libimagequant / check_image_size

Function check_image_size

imagequant-sys/src/ffi.rs:581–595  ·  view source on GitHub ↗
(attr: &liq_attr, width: u32, height: u32)

Source from the content-addressed store, hash-verified

579}
580
581pub(crate) fn check_image_size(attr: &liq_attr, width: u32, height: u32) -> bool {
582 if bad_object!(attr, LIQ_ATTR_MAGIC) { return false; }
583
584 if width == 0 || height == 0 {
585 return false;
586 }
587
588 if width as usize > c_int::MAX as usize / std::mem::size_of::<liq_color>() / height as usize ||
589 width as usize > c_int::MAX as usize / 16 / std::mem::size_of::<f32>() ||
590 height as usize > c_int::MAX as usize / std::mem::size_of::<usize>()
591 {
592 return false;
593 }
594 true
595}
596
597#[no_mangle]
598#[inline(never)]

Callers 3

liq_image_create_rgbaFunction · 0.85
new_internalMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected