Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-11 08:14:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-11 08:14:06 +0300
commit2d60845786aeab099c61ffa42b7f72cccc68bff1 (patch)
treeaa3f17a33f029f9a8de69b081d219ee506e71f8e /source/blender/imbuf/intern/targa.c
parent99f56b4c16323f96c0cbf54e392fb509fcac5bda (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/targa.c')
-rw-r--r--source/blender/imbuf/intern/targa.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 6d156a637d3..64dbf6deb4b 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -361,7 +361,7 @@ bool imb_savetarga(struct ImBuf *ibuf, const char *filepath, int UNUSED(flags))
return ok;
}
-static int checktarga(TARGA *tga, const unsigned char *mem)
+static bool checktarga(TARGA *tga, const unsigned char *mem)
{
tga->numid = mem[0];
tga->maptyp = mem[1];
@@ -378,7 +378,7 @@ static int checktarga(TARGA *tga, const unsigned char *mem)
tga->imgdes = mem[17];
if (tga->maptyp > 1) {
- return 0;
+ return false;
}
switch (tga->imgtyp) {
case 1: /* raw cmap */
@@ -389,27 +389,27 @@ static int checktarga(TARGA *tga, const unsigned char *mem)
case 11: /* b&w */
break;
default:
- return 0;
+ return false;
}
if (tga->mapsize && tga->mapbits > 32) {
- return 0;
+ return false;
}
if (tga->xsize <= 0) {
- return 0;
+ return false;
}
if (tga->ysize <= 0) {
- return 0;
+ return false;
}
if (tga->pixsize > 32) {
- return 0;
+ return false;
}
if (tga->pixsize == 0) {
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-int imb_is_a_targa(const unsigned char *buf)
+bool imb_is_a_targa(const unsigned char *buf, size_t UNUSED(size))
{
TARGA tga;