#![no_main] use libfuzzer_sys::fuzz_target; externcrate qcms; externcrate libc; /* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use qcms::c_bindings::{qcms_profile, icSigRgbData, icSigCmykData, icSigGrayData, qcms_profile_is_bogus}; use qcms::c_bindings::{qcms_profile_get_color_space, qcms_profile_get_rendering_intent, qcms_profile_from_memory, qcms_profile_release, qcms_profile_sRGB, qcms_transform_create}; use qcms::c_bindings::{qcms_profile_precache_output_transform, qcms_transform_data, qcms_transform_release, qcms_enable_iccv4};
use qcms::DataType::*;
unsafefn transform(src_profile: *const qcms_profile, dst_profile: *mut qcms_profile, size: usize)
{ // qcms supports GRAY and RGB profiles as input, and RGB as output.
let dst_color_space = qcms_profile_get_color_space(&*dst_profile); if dst_color_space != icSigRgbData { return;
} let dst_type = if (size & 2) != 0 { RGBA8 } else { RGB8 };
let intent = qcms_profile_get_rendering_intent(&*src_profile); // Firefox calls this on the display profile to increase performance. // Skip with low probability to increase coverage. if (size % 15) != 0 {
qcms_profile_precache_output_transform(&mut *dst_profile);
}
let transform =
qcms_transform_create(&*src_profile, src_type, &*dst_profile, dst_type, intent); if transform == std::ptr::null_mut() { return;
}
qcms_transform_data(&*transform, src.as_ptr() as *const libc::c_void, dst.as_mut_ptr() as *mutlibc::c_void, (SRC_SIZE / src_type.bytes_per_pixel()) as usize);
qcms_transform_release(transform);
}
unsafefn do_fuzz(data: &[u8])
{ let size = data.len();
qcms_enable_iccv4();
let profile = qcms_profile_from_memory(data.as_ptr() as *const libc::c_void, size); if profile == std::ptr::null_mut() { return;
}
let srgb_profile = qcms_profile_sRGB(); if srgb_profile == std::ptr::null_mut() {
qcms_profile_release(profile); return;
}
transform(profile, srgb_profile, size);
// Firefox only checks the display (destination) profile. if !qcms_profile_is_bogus(&mut *profile) {
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.