0eebfba388
read_header_tga in gd_tga.c in the GD Graphics Library (aka LibGD) through 2.3.2 allows remote attackers to cause a denial of service (out-of-bounds read) via a crafted TGA file. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
30 lines
872 B
Diff
30 lines
872 B
Diff
From 8b111b2b4a4842179be66db68d84dda91a246032 Mon Sep 17 00:00:00 2001
|
|
From: maryam ebrahimzadeh <maryam.ebr@student.sharif.edu>
|
|
Date: Mon, 19 Jul 2021 10:07:13 +0430
|
|
Subject: [PATCH] fix read out-of-bands in reading tga header file
|
|
|
|
[Retrieved from:
|
|
https://github.com/libgd/libgd/commit/8b111b2b4a4842179be66db68d84dda91a246032]
|
|
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
---
|
|
src/gd_tga.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/gd_tga.c b/src/gd_tga.c
|
|
index cae9428da..286febb28 100644
|
|
--- a/src/gd_tga.c
|
|
+++ b/src/gd_tga.c
|
|
@@ -191,7 +191,11 @@ 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;
|