blob: 6152a118435deecd9c6ec987172de8c11ba406bb [file] [log] [blame]
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05001From 8b111b2b4a4842179be66db68d84dda91a246032 Mon Sep 17 00:00:00 2001
2From: maryam ebrahimzadeh <maryam.ebr@student.sharif.edu>
3Date: Mon, 19 Jul 2021 10:07:13 +0430
4Subject: [PATCH] fix read out-of-bands in reading tga header file
5
6---
7 src/gd_tga.c | 6 +++++-
8 1 file changed, 5 insertions(+), 1 deletion(-)
9
10diff --git a/src/gd_tga.c b/src/gd_tga.c
11index cae9428..286febb 100644
12--- a/src/gd_tga.c
13+++ b/src/gd_tga.c
14@@ -191,7 +191,11 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga)
15 return -1;
16 }
17
18- gdGetBuf(tga->ident, tga->identsize, ctx);
19+
20+ if (gdGetBuf(tga->ident, tga->identsize, ctx) != tga->identsize) {
21+ gd_error("fail to read header ident");
22+ return -1;
23+ }
24 }
25
26 return 1;
27--
282.25.1
29