Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.81k stars 318 forks source link

Segfault in lut.h #4390

Closed Beep6581 closed 6 years ago

Beep6581 commented 6 years ago

5.3-628-g9f89ff2d

https://filebin.net/aoha8bi9nmyt9tnh

  1. Open the raw + PP3.
  2. Reset Exposure > Tone Curve 1.
  3. Drag the bottom-left node to top-left (the second step would be to drag the top-right node bottom-right, to make the image negative, but it crashes).
Thread 2345 "rawtherapee" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 7117]
0x000055555604f464 in LUT<float>::operator[]<float, void> (this=0x55555d951490, index=-nan(0x400000)) at /home/morgan/programs/code-rawtherapee/rtengine/LUT.h:512
512             T p1 = data[idx];
(gdb) bt full
#0  0x000055555604f464 in LUT<float>::operator[]<float, void> (this=0x55555d951490, index=-nan(0x400000)) at /home/morgan/programs/code-rawtherapee/rtengine/LUT.h:512
        idx = -2147483648
        diff = -nan(0x400000)
        p1 = 0
        p2 = 0
#1  0x00005555561c1a7c in rtengine::WavCurve::operator[] (this=0x55555d951480, index=-nan(0x400000)) at /home/morgan/programs/code-rawtherapee/rtengine/curves.h:550
No locals.
#2  0x00005555561b1147 in rtengine::ImProcFunctions::ContAllL (this=0x55555d94fa98, koeLi=0x7fff8effb2c0, maxkoeLi=0x7fff8effb290, lipschitz=true, maxlvl=7, labco=0x555559707550, varhue=0x7fff842e5e80, varchrom=0x7fff8441a3c0, WavCoeffs_L=0x7fff840027d0, 
    WavCoeffs_L0=0x7fff843bf4b0, level=1, dir=1, cp=..., W_L=305, H_L=204, skip=9, mean=0x7fff8effb610, sigma=0x7fff8effb670, MaxP=0x7fff8effb6d0, MaxN=0x7fff8effb700, wavCLVCcurve=..., waOpacityCurveW=..., ChCurve=0x0, Chutili=false)
    at /home/morgan/programs/code-rawtherapee/rtengine/ipwavelet.cc:2827
        abssd = 4
        b_abssd = 7.00450468
        bbssd = 2
        maxamp = 2.5
        maxampd = 10
        da_abssd = 18.0180187
        kmuld = -nan(0x400000)
        kcd = 0
        a_abssd = -4.50450468
        db_abssd = -8.01801872
        am = 3.00300288
        kc = 0
        k = 306
        j = 1
        i = 1
        insigma = 0.666000009
        inx = -0.40646559
        bsig = -nan(0x400000)
        iny = -nan(0x400000)
        amean = inf
        absciss = -nan(0x400000)
        kinterm = 1
        logmax = -inf
        rapX = -nan(0x400000)
        rap = -nan(0x400000)
        asig = inf
        kmul = -nan(0x400000)
        borderL = 1
        koe = 0x0
        rad = 0.25
        value = 0.222222224
        lim0 = 20
        lev = 1
        al0 = 1.17499995
        maxkoe = 0
        edge = 1.10851645
        bk = 1.17499995
        koef = 1.15749991
        expkoef = -0.716775954
        repart = 8.75
        arepart = 1.5
        al10 = 1
        ak = -0.0174999945
        edgePrecalc = 1.10851645
        brepart = 0.5
        refin = 0.10851647
        __PRETTY_FUNCTION__ = "void rtengine::ImProcFunctions::ContAllL(float**, float*, bool, int, rtengine::LabImage*, float**, float**, float**, float*, int, int, rtengine::cont_params&, int, int, int, float*, float*, float*, fl"...
        scales = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512}
        scaleskip = {0.111111112, 0.222222224, 0.444444448, 0.888888896, 1.77777779, 3.55555558, 7.11111116, 14.2222223, 28.4444447, 56.8888893}
        t_r = 40
        t_l = 10
        b_r = 75
        edd = 3
---Type <return> to continue, or q <return> to quit---
        eddstrength = 1.29999995
        aedstr = 0.00333333272
        bedstr = 0.966666698
        cpMul = 0
        choicelevel = 0
#3  0x00005555561bd7f7 in rtengine::ImProcFunctions::WaveletcontAllL () at /home/morgan/programs/code-rawtherapee/rtengine/ipwavelet.cc:2028
        Wlvl_L = 305
        WavCoeffs_L = 0x7fff840027d0
        dir = 1
        Hlvl_L = 204
        lvl = 1
        edd = 3
        eddlow = 15
        eddlipinfl = 0.699999988
        eddlipampl = 1.20000005
        labco = 0x555559707550
        varhue = 0x7fff842e5e80
        varchrom = 0x7fff8441a3c0
        WaveletCoeffs_L = @0x7fff84006b70: {<rtengine::NonCopyable> = {<No data fields>}, coeff0 = 0x7fff843bf4b0, memoryAllocationFailed = false, static maxlevels = 10, lvltot = 6, subsamp = 1, numThreads = 4, m_w = 610, m_h = 407, wavfilt_len = 6, wavfilt_offset = 2,
          wavfilt_anal = 0x7fff84008fa0, wavfilt_synth = 0x7fff84002470, wavelet_decomp = {0x7fff84002760, 0x7fff84008e70, 0x7fff84008eb0, 0x7fff84008f20, 0x7fff84009550, 0x7fff840095c0, 0x7fff84005340, 0x3fd3750d28dd35a6, 0x3fd395d138d8f285, 0x90}}
        cp = @0x7fff8effba40: {mul = {0, 0, 0, 0, 0, 0, 0, 3.0611365e-41, -2.05115442e-36, 0}, chrom = 5, chro = 0, contrast = 0, th = 35, thH = 65, conres = 0, conresH = 0, chrores = 0, hueres = 2, sky = 0, b_l = -0.0500000007, t_l = 0.25, b_r = 1.70000005,
          t_r = 1.20000005, b_ly = -2.5999999, t_ly = -2.5, b_ry = -1.29999995, t_ry = -1.39999998, b_lsl = 0, t_lsl = 2, b_rsl = 50, t_rsl = 25, b_lhl = 50, t_lhl = 75, b_rhl = 100, t_rhl = 98, edg_low = 0, edg_mean = 10, edg_sd = 40, edg_max = 75, lev0s = 0,
          lev0n = 0, lev1s = 0, lev1n = 0, lev2s = 0, lev2n = 0, lev3s = 0, lev3n = 0, b_lpast = 0, t_lpast = 2, b_rpast = 30, t_rpast = 20, b_lsat = 30, t_lsat = 45, b_rsat = 130, t_rsat = 100, rad = 15, val = 10, til = 10, numlevH = 5, numlevS = 4, mulC = {0, 0, 0,
            0, 0, 0, 0, -2.05043982e-36, 4.59163468e-41}, mulopaRG = {0, 0, 0, 0, 0, 0, 0, 0, 0}, mulopaBY = {0, 0, 0, 0, 0, 0, 0, 0, 0}, curv = false, opaBY = true, opaRG = true, edgcurv = true, diagcurv = true, CHmet = 0, CHSLmet = 1, EDmet = 2, HSmet = true,
          avoi = false, strength = 1, reinforce = 3, detectedge = false, backm = 1, eddet = 90, eddetthr = 20, eddetthrHi = 0, link = true, lip3 = false, tonemap = false, diag = false, TMmeth = 557592245, tmstrength = 0, balan = 0, ite = 0, contmet = 1, opaW = false,
          BAmet = 250, bam = false, blhigh = 0, grhigh = 0, blmed = 0, grmed = 0, bllow = 0, grlow = 0, cbena = false, contena = false, chromena = false, edgeena = true, resena = false, finena = false, toningena = false, noiseena = false, maxilev = 7, edgsens = 60,
          edgampl = 10, neigh = 0, lipp = false}
        skip = 9
        mean = 0x7fff8effb610
        sigma = 0x7fff8effb670
        MaxP = 0x7fff8effb6d0
        MaxN = 0x7fff8effb700
        wavCLVCcurve = @0x55555d951480: {_vptr.WavCurve = 0x5555569588c0 <vtable for rtengine::WavCurve+16>, lutWavCurve = {<rtengine::NonCopyable> = {<No data fields>}, maxs = 499, maxsf = 499, maxIndexFloat = 500, data = 0x7fff84003800, clip = 268435455, size = 501,
            upperBound = 500, owner = 1, maxsv = {499, 499, 499, 499}, sizev = {500, 500, 500, 500}, sizeiv = {2147483648500, 2147483648500}, dirty = true}, sum = 201.545013}
        waOpacityCurveW = @0x55555d951610: {_vptr.WavOpacityCurveW = 0x555556958860 <vtable for rtengine::WavOpacityCurveW+16>, lutOpacityCurveW = {<rtengine::NonCopyable> = {<No data fields>}, maxs = 499, maxsf = 499, maxIndexFloat = 500, data = 0x7fff842e7640,
            clip = 268435455, size = 501, upperBound = 500, owner = 1, maxsv = {499, 499, 499, 499}, sizev = {500, 500, 500, 500}, sizeiv = {2147483648500, 2147483648500}, dirty = true}}
        ChCurve = 0x0
        Chutili = false
        this = 0x55555d94fa98
        maxlvl = 7
        W_L = 305
        H_L = 204
        WavCoeffs_L0 = 0x7fff843bf4b0
        contrast = 0
        max0 = 0
        min0 = 1.03845937e+36
        ave = 0
        ah = -nan(0x400000)
        bh = -nan(0x400000)
        al = -0
        bl = 1
        factorx = 1
        koeLi = {0x7fff84a0a4d0, 0x7fff84a47100, 0x7fff84a83d30, 0x7fff84ac0960, 0x7fff84afd590, 0x7fff84b3a1c0, 0x7fff84b76df0, 0x7fff84bb3a20, 0x7fff84bf0650, 0x7fff84c2d280, 0x7fff84c69eb0, 0x7fff84ca6ae0}
        maxkoeLi = {0 <repeats 12 times>}
        tmC.373 = 0x7fff4633f9c0
#4  0x00007ffff14f81fb in ?? () from /usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libgomp.so.1
No symbol table info available.
#5  0x00007ffff10aea43 in ?? () from /lib64/libpthread.so.0
No symbol table info available.
#6  0x00007ffff0de630f in clone () from /lib64/libc.so.6
No symbol table info available.
heckflosse commented 6 years ago

Bug confirmed. Looking.

heckflosse commented 6 years ago

Fixed with this patch:

diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc
index f4842940..4ffe9c9a 100644
--- a/rtengine/ipwavelet.cc
+++ b/rtengine/ipwavelet.cc
@@ -2745,7 +2745,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit

         float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance"

-        if(cp.EDmet == 2) { //curve
+        if(cp.EDmet == 2 && MaxP[level] > 0.f) { //curve
             //  if(exa) {//curve
             float insigma = 0.666f; //SD
             float logmax = log(MaxP[level]); //log Max
Beep6581 commented 6 years ago

Fix confirmed.