diff --git a/ext/gd/libgd/gd_tga.c b/ext/gd/libgd/gd_tga.c index 3f9922189aada..f888f9ea6fbe9 100644 --- a/ext/gd/libgd/gd_tga.c +++ b/ext/gd/libgd/gd_tga.c @@ -191,7 +191,10 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga) return -1; } - gdGetBuf(tga->ident, tga->identsize, ctx); + if (gdGetBuf(tga->ident, tga->identsize, ctx) != tga->identsize) { + gd_error("fail to read header ident"); + return -1; + } } return 1;