diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-11-11 08:14:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-11-11 08:14:06 +0300 |
commit | 2d60845786aeab099c61ffa42b7f72cccc68bff1 (patch) | |
tree | aa3f17a33f029f9a8de69b081d219ee506e71f8e /source/blender/imbuf/intern/png.c | |
parent | 99f56b4c16323f96c0cbf54e392fb509fcac5bda (diff) |
Cleanup: pass header size to 'is_a' callbacks
No functional changes, prepare for fixing out-of-bounds access
when reading headers.
Diffstat (limited to 'source/blender/imbuf/intern/png.c')
-rw-r--r-- | source/blender/imbuf/intern/png.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 1f90f91be3e..a4ad839c513 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -59,9 +59,9 @@ BLI_INLINE unsigned short UPSAMPLE_8_TO_16(const unsigned char _val) return (_val << 8) + _val; } -int imb_is_a_png(const unsigned char *mem) +bool imb_is_a_png(const unsigned char *mem, size_t UNUSED(size)) { - int ret_val = 0; + bool ret_val = 0; #if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR == 2) /* Older version of libpng doesn't use const pointer to memory. */ @@ -548,7 +548,7 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors float *to_float; unsigned int channels; - if (imb_is_a_png(mem) == 0) { + if (imb_is_a_png(mem, size) == 0) { return NULL; } |