Skip to content

Commit f89eb15

Browse files
authored
Note that this is not actually security related[1], but still a reasonable sanity check. "If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest it cannot happen to me, the gods shall surely punish thee for thy arrogance." – Henry Spencer [1] <libgd/libgd#697 (comment)>
1 parent 99bceda commit f89eb15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/gd/libgd/gd_tga.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga)
191191
return -1;
192192
}
193193

194-
gdGetBuf(tga->ident, tga->identsize, ctx);
194+
if (gdGetBuf(tga->ident, tga->identsize, ctx) != tga->identsize) {
195+
gd_error("fail to read header ident");
196+
return -1;
197+
}
195198
}
196199

197200
return 1;

0 commit comments

Comments
 (0)