Fix for bad imbuf creation by compositor viewers if resolution is (0,0).

This can happen if no image buffers are used to define a sensible
resolution. Then the viewer will stiff create a float buffer in the
output imbuf, which defies the usual ibuf->rect_float check and leads
to invalid memory access. Float buffer should not be created in this
case.
This commit is contained in:
Lukas Tönne 2014-02-20 12:07:34 +01:00
parent 47c55c5d43
commit 4789793f09

@ -143,7 +143,9 @@ void ViewerOperation::initImage()
IMB_freezbuffloatImBuf(ibuf);
ibuf->x = getWidth();
ibuf->y = getHeight();
imb_addrectfloatImBuf(ibuf);
/* zero size can happen if no image buffers exist to define a sensible resolution */
if (ibuf->x > 0 && ibuf->y > 0)
imb_addrectfloatImBuf(ibuf);
ima->ok = IMA_OK_LOADED;
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;