diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-20 15:07:34 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-02-20 15:09:47 +0400 |
commit | 4789793f0903fe0ce9daa30c013a4fccf4971e89 (patch) | |
tree | f76096d316003864aa859519ef12e2881f393165 /source/blender/compositor/operations/COM_ViewerOperation.cpp | |
parent | 47c55c5d437c6ad628512f50fa53b7477c42938b (diff) |
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.
Diffstat (limited to 'source/blender/compositor/operations/COM_ViewerOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ViewerOperation.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index f53f2b87f98..c54a4971e54 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -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; |