Skip to content

Commit

Permalink
Fix iridas cube parser to accept and convert double precision.
Browse files Browse the repository at this point in the history
The old Iridas cube parser would silently convert double precision values to floats and continue working, wheras the current code will raise an "Invalid color triplets" error.

This patch restores the older behaviour.

Signed-off-by: Shootfast <[email protected]>
  • Loading branch information
Shootfast authored Sep 23, 2024
1 parent aa7fac0 commit 0ff5951
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/OpenColorIO/fileformats/FileFormatIridasCube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,12 @@ LocalFileFormat::read(std::istream & istream,
}
else
{
float r = NAN;
float g = NAN;
float b = NAN;
// Use doubles here as some iridas cube files may be written with double precision
// string values, and these will raise result_out_of_range errors in NumberUtils::from_chars
// instead of silently converting to float like they used to
double r = NAN;
double g = NAN;
double b = NAN;

const auto rAnswer = NumberUtils::from_chars(valR, valR + 64, r);
const auto gAnswer = NumberUtils::from_chars(valG, valG + 64, g);
Expand Down

0 comments on commit 0ff5951

Please sign in to comment.