fillRectList(const juce::RectangleList<float> - Missing Range Check crash

not sure how i get to this result, but i think there should be a rangecheck, when the Rectangle-list contains silly values

addEdgePointPair, crashes if y is negative, shouldn't there be a range check

const Rectangle<float>* r = 

 {pos={x=512.000000 y=-1330.39221 } w=1.00000000 h=1.59887695 }

First-chance exception at 0x556E85AB (my.dll) in Cubase7.exe: 0xC0000005: Access violation reading location 0x301CF8FC.


     juce::EdgeTable::addEdgePointPair(int x1=131072, int x2=131328, int y=-1331, int winding=99) Line 439    C++
>    juce::EdgeTable::EdgeTable(const juce::RectangleList<float> & rectanglesToAdd={...}) Line 179    C++
     juce::RenderingHelpers::ClipRegions<juce::RenderingHelpers::SoftwareRendererSavedState>::EdgeTableRegion::EdgeTableRegion(const juce::RectangleList<float> & r={...}) Line 1588    C++
     juce::RenderingHelpers::SavedStateBase<juce::RenderingHelpers::SoftwareRendererSavedState>::fillRectList(const juce::RectangleList<float> & list={...}) Line 2256    C++
     juce::RenderingHelpers::StackBasedLowLevelGraphicsContext<juce::RenderingHelpers::SoftwareRendererSavedState>::fillRectList(const juce::RectangleList<float> & list={...}) Line 2661    C++
     juce::Graphics::fillRectList(const juce::RectangleList<float> & rectangles={...}) Line 364    C++
     SpectrumDisplayComponent::paint(juce::Graphics & g={...}) Line 160    C++
     juce::Component::paintComponentAndChildren(juce::Graphics & g={...}) Line 1964    C++
     juce::Component::paintEntireComponent(juce::Graphics & g={...}, bool ignoreAlphaLevel=false) Line 2069    C++
     juce::Component::paintWithinParentContext(juce::Graphics & g={...}) Line 1947    C++
     juce::Component::paintComponentAndChildren(juce::Graphics & g={...}) Line 2010    C++
     juce::Component::paintEntireComponent(juce::Graphics & g={...}, bool ignoreAlphaLevel=false) Line 2069    C++
     juce::Component::paintWithinParentContext(juce::Graphics & g={...}) Line 1947    C++
     juce::Component::paintComponentAndChildren(juce::Graphics & g={...}) Line 2010    C++
     juce::Component::paintEntireComponent(juce::Graphics & g={...}, bool ignoreAlphaLevel=false) Line 2069    C++
     juce::Component::paintWithinParentContext(juce::Graphics & g={...}) Line 1947    C++
     juce::Component::paintComponentAndChildren(juce::Graphics & g={...}) Line 2010    C++
     juce::Component::paintEntireComponent(juce::Graphics & g={...}, bool ignoreAlphaLevel=false) Line 2069    C++
     juce::Component::paintWithinParentContext(juce::Graphics & g={...}) Line 1947    C++
     juce::Component::paintComponentAndChildren(juce::Graphics & g={...}) Line 2010    C++
     juce::Component::paintEntireComponent(juce::Graphics & g={...}, bool ignoreAlphaLevel=true) Line 2069    C++
     juce::ComponentPeer::handlePaint(juce::LowLevelGraphicsContext & contextToPaintTo={...}) Line 160    C++
     juce::HWNDComponentPeer::performPaint(HDC__ * dc=0x040124d6, HRGN__ * rgn=0x0f042504, int regionType=2, tagPAINTSTRUCT & paintStruct={...}) Line 1646    C++
     juce::HWNDComponentPeer::handlePaintMessage() Line 1541    C++
     juce::HWNDComponentPeer::peerWindowProc(HWND__ * h=0x00100402, unsigned int message=15, unsigned int wParam=0, long lParam=0) Line 2406    C++
     juce::HWNDComponentPeer::windowProc(HWND__ * h=0x00100402, unsigned int message=15, unsigned int wParam=0, long lParam=0) Line 2358    C++


Looks like an edge case somewhere is letting the negative Y value slip through - it shouldn't get as far as reaching the addEdgePointPair call. Do you have code that I could use to try to reproduce this?

(forum upload seems not to work), 

i think there the reason are #INF values in the rectangle-list which, which let "bounds" to be

bounds    {pos={x=0 y=-2147483648 }

which result in the negativ y in  addEdgePointPair


        lastLine    234    const int
        x1    116992    const int
        y1    -338480    const int
        x2    117248    const int
        y2    59904    const int
        y    -1323    int
+        e    0x30d4dae8 {pos={x=-4.22016832e+037 y=-1.21979282e-012 } w=-1.21979282e-012 h=-1.58839967e+038 }    const juce::Rectangle<float> * const
+        r    0x30d4d618 {pos={x=457.000000 y=-1322.18689 } w=1.00000000 h=1556.18689 }    const juce::Rectangle<float> *
-        this    0x30993120 {table={data=0x30e3de90 {0} } bounds={pos={x=0 y=-2147483648 } w=534 h=1 } maxEdgesPerLine=...}    juce::EdgeTable *
+        table    {data=0x30e3de90 {0} }    juce::HeapBlock<int,0>
-        bounds    {pos={x=0 y=-2147483648 } w=534 h=1 }    juce::Rectangle<int>
+        pos    {x=0 y=-2147483648 }    juce::Point<int>
        w    534    int
        h    1    int
        maxEdgesPerLine    1068    int
        lineStrideElements    2137    int
        needToCheckEmptiness    true    bool
        leakDetector216    {...}    juce::LeakedObjectDetector<juce::EdgeTable>
-        rectanglesToAdd    {rects={data={elements={data=0x30d4b988 {...} } numAllocated=534 } numUsed=534 } }    const juce::RectangleList<float> &
-        rects    {data={elements={data=0x30d4b988 {pos={...} w=1.00000000 h=1.#INF0000 } } numAllocated=534 } numUsed=...}    juce::Array<juce::Rectangle<float>,juce::DummyCriticalSection,0>
-        data    {elements={data=0x30d4b988 {pos={x=0.000000000 y=-1.#INF0000 } w=1.00000000 h=1.#INF0000 } } numAllocated=...}    juce::ArrayAllocationBase<juce::Rectangle<float>,juce::DummyCriticalSection>
        juce::DummyCriticalSection    {...}    juce::DummyCriticalSection
-        elements    {data=0x30d4b988 {pos={x=0.000000000 y=-1.#INF0000 } w=1.00000000 h=1.#INF0000 } }    juce::HeapBlock<juce::Rectangle<float>,0>
-        data    0x30d4b988 {pos={x=0.000000000 y=-1.#INF0000 } w=1.00000000 h=1.#INF0000 }    juce::Rectangle<float> *
-        pos    {x=0.000000000 y=-1.#INF0000 }    juce::Point<float>
        x    0.000000000    float
        y    -1.#INF0000    float
        w    1.00000000    float
        h    1.#INF0000    float
        numAllocated    534    int
        numUsed    534    int

ok, but where did those values come from? I'd need to be able to reproduce this in order to work out where these values need to be caught.

The #INF values in the Rectangle List, come from my spectrum analyzer, they are of cause wrong, but i think this should not result in a bad access, when i give any kind of floats to a UI routine.   

This is why the assertion is there. If you run your code in debug mode you should be hitting the assertion first. This is to warn you that without fixing something needs fixing - in your case, it's the spectrum analyzer.

well i didn't run into any assertion. 

IMHO, wherever i give  a float value to user-infterface-subroutine (there can always be edge cases (for examples because of rounding erros) in release builds, where INFs or NANs are generated, and INF and NANs ARE valid Float-values) it should never result in "BAD ACCESS" exception which crashes an application. 

If i give a wrong pointer, or wrong integer index or length, this would be ok, but giving a "wrong" float value to a UI-subroutine should not crash an application.