Really big numbers crash fillRectList

Really big numbers crash fillRectList

Windows 10. 64 bit. VS2017

    RectangleList<float> events;

    for (int i = 100; i < 200; i++)
        events.addWithoutMerging ({1302850.25f + (i + 1) * 60000.0f , 19.0000000f, 1.00000000f, 53.0000000f });

    g.setColour (Colours::red);
    g.fillRectList (events);

Code to reproduce:

Does ‘i’ get to any number in particular?
Does it assert at all on the ‘finite’ check?

It asserts on:

jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight());

juce_EdgeTable.h : 126

It does not assert within addWithoutMerging()

So it asserts when massively out of bounds? Sounds reasonable to me.

Assert is correct. But it shouldn’t crash.

I’m not sure about this. An assertion is something that has to be true to be a well formed program. If an assertion fails, you’ve broken the contract of the method and all bets are off.

Lots of people define assertions to be hard crashes so they can be caught in logs rather then causing things like heap corruptions which can be very difficult to track down later.

There’s actually lots of discussion in the standard at the moment about whether you should be able to continue past a C++20 [[ assert: x < 20 ]]. The main argument for this that it could be useful for testing but is still generally considered a blocking bug.

What actually causes the crash here?

1 Like

It calls iterationCallback.handleEdgeTablePixelFull (x); with an x value of -8334366