Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STATUS_ACCESS_VIOLATION when writing vcgt tag #19

Closed
vaisest opened this issue Jan 11, 2024 · 1 comment
Closed

STATUS_ACCESS_VIOLATION when writing vcgt tag #19

vaisest opened this issue Jan 11, 2024 · 1 comment

Comments

@vaisest
Copy link

vaisest commented Jan 11, 2024

I tried using this library to create a custom ICC profile with a custom VCGT. I have no clue if I'm using this library correctly, but I managed to produce a very confusing error with the following code:

use std::path::Path;

use lcms2::{Locale, Profile, Tag, ToneCurve, MLU};

fn main() {
    let mut icc = Profile::new_srgb();

    icc.remove_tag(lcms2::TagSignature::ProfileDescriptionTag);

    let mut desc = MLU::new(1);
    desc.set_text("Test ICC", Locale::none());
    icc.write_tag(lcms2::TagSignature::ProfileDescriptionTag, Tag::MLU(&desc));

    let tc = ToneCurve::new(2.0);

    let tc_refs: [&lcms2::ToneCurveRef; 3] = [&tc, &tc, &tc];
    let vcgt_tag = Tag::VcgtCurves(tc_refs);
    icc.write_tag(lcms2::TagSignature::VcgtTag, vcgt_tag);

    println!("saving profile to out.icc...");
    icc.save_profile_to_file(Path::new("out.icc")).expect("error while saving profile");
}

Running the program with lcms2 = 6.0.3 results in: error: process didn't exit successfully: 'target\debug\rs-lcms-test.exe' (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION).

While I have no clue what I'm doing, I feel like the intent is not to crash in a way like this?

@kornelski
Copy link
Owner

Thanks for the report. Fixed in 3730909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants