Skip to content

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