ART crashes with some images when running function "RawImageSource::getAutoMatchedToneCurve"

Issue #244 resolved
t.guillermin created an issue

app crashes with some images when running function "RawImageSource::getAutoMatchedToneCurve" (histmatching.cc file).

....

CurveEvaluator eval(*source, *target);

size_t best = candidates.size();

double bestscore = RT_INFINITY;

for (size_t i = 0; i < candidates.size(); ++i) {

double score = eval(candidates[i]); // --> crash

...

After searching, the following lines produce the crash

int l = c.getVal(img_[y][x]) * 255.f;

++hist[l]; // --> l > 255 To avoid the crash,

I added this modification:

if (l < 256) ++hist[l];

But, this is not a good solution, the best would be for c.getVal(...) to return a value between 0 and 1.

Congratulations again for your fantastic work

Comments (5)

  1. agriggio repo owner

    I’m not sure the OM-1 is fully supported yet, it only comes in a unreleased version of libraw (not even the latest snapshot). Do you have another example where this crashes?

    Note: this is most definitely a bug, but I’d like to understand a bit better when it happens…

  2. Log in to comment