diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-12-10 12:37:46 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-12-10 12:37:46 +0300 |
commit | fcf8fc3eaa34996cb89b156ba15ced767dc42f08 (patch) | |
tree | 99124ed80f9bfa02bf1f6de9ff0cb899db78a424 /source/blender/imbuf/intern/allocimbuf.c | |
parent | 57f46b9d5f370dfacc92786dab596060400a21a8 (diff) |
Fix Crash: Loading Huge Images.
When loading huge images (30k) blender crashed with a buffer overflow.
The reason is that determine the length of a buffer was done in 32bit
precision and afterwards stored in 64 bit precision.
This patch adds a new function to do the correct calculation in 64bit.
It should be added to other sections in blender as well. But that should
be tested on a per case situation.
Diffstat (limited to 'source/blender/imbuf/intern/allocimbuf.c')
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 9bace323372..197d7e6b1d5 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -663,6 +663,11 @@ ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) return ibuf2; } +size_t IMB_get_rect_len(const ImBuf *ibuf) +{ + return (size_t)ibuf->x * (size_t)ibuf->y; +} + size_t IMB_get_size_in_memory(ImBuf *ibuf) { int a; |