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

fix UI crasher caused by negative (unexpected) colorspace vrgb components. #154

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

atsushieno
Copy link
Contributor

The following code somehow results in negative r value component:

    ColorSpaces::vec3 vrgb = ColorSpaces::hcy_to_rgb(vhcy);

... while hcy_to_rgb() itself calculates vec3 (std::array<float,3>) as expected. Negative components then leads to runtime crash.

Considering that the function might return negative values anyway, filter out those negative values here at SColorRGB constructor to sanitize inputs.

…ents.

The following code somehow results in negative r value component:

```C++
    ColorSpaces::vec3 vrgb = ColorSpaces::hcy_to_rgb(vhcy);
```

... while hcy_to_rgb() itself calculates `vec3` (`std::array<float,3>`) as
expected. Negative components then leads to runtime crash.

Considering that the function might return negative values anyway, filter
out those negative values here at SColorRGB constructor to sanitize inputs.
@atsushieno
Copy link
Contributor Author

Some contexts: attaching how the relevant code looks on CLion debugger (lldb).

At hcy_to_rgb() (the callee):

Screenshot 2024-12-14 at 22 49 33

At SColorRGB::SColorRGB() (the caller):

Screenshot 2024-12-14 at 22 49 56

@atsushieno
Copy link
Contributor Author

Since nobody had complained about this, it is likely specific to macOS arm64 environment (the build has been broken for a while, which likely means no one tried to build it).

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

Successfully merging this pull request may close these issues.

1 participant