diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-12 18:58:58 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-12 18:58:58 +0400 |
commit | 5354998a215ec1900ec401ecdb01aae61fa02f5e (patch) | |
tree | e683d71ccfc6f09551ec8c93fc91effcdf76d394 | |
parent | d095bcc8aa9ec60e537ed86b48f1025623cb2b38 (diff) |
Fix #34213: crash loading openexr multilayer with use alpha disabled.
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index d2b0645cf93..cae705ae798 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -594,11 +594,17 @@ void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, i void IMB_rectfill_alpha(ImBuf *ibuf, const float value) { int i; + if (ibuf->rect_float) { - float *fbuf = ibuf->rect_float + 3; + float *fbuf; + + if (ibuf->channels != 4) return; + + fbuf = ibuf->rect_float + 3; for (i = ibuf->x * ibuf->y; i > 0; i--, fbuf += 4) { *fbuf = value; } } - else { + + if (ibuf->rect) { const unsigned char cvalue = value * 255; unsigned char *cbuf = ((unsigned char *)ibuf->rect) + 3; for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf += 4) { *cbuf = cvalue; } |