!24 fix CVE-2023-45663

From: @peijiankang 
Reviewed-by: @dou33 
Signed-off-by: @dou33
This commit is contained in:
openeuler-ci-bot 2024-02-28 01:15:20 +00:00 committed by Gitee
commit d9a0777f38
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 50 additions and 0 deletions

38
1543.patch Normal file
View File

@ -0,0 +1,38 @@
From 20f77a9b7f53624014e8c7224eeb182674111bcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaroslav=20Loba=C4=8Devski?= <jarlob@github.com>
Date: Thu, 19 Oct 2023 16:10:45 +0200
Subject: [PATCH] Fix disclosure of uninitialized memory in stbi__tga_load
Fixes #1542
---
stb_image.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/stb_image.h b/stb_image.h
index 5e807a0a6..7db6dd3df 100644
--- a/stb_image.h
+++ b/stb_image.h
@@ -5933,7 +5933,10 @@ static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req
for (i=0; i < tga_height; ++i) {
int row = tga_inverted ? tga_height -i - 1 : i;
stbi_uc *tga_row = tga_data + row*tga_width*tga_comp;
- stbi__getn(s, tga_row, tga_width * tga_comp);
+ if(!stbi__getn(s, tga_row, tga_width * tga_comp)) {
+ STBI_FREE(tga_data);
+ return stbi__errpuc("bad palette", "Corrupt TGA");
+ }
}
} else {
// do I need to load a palette?
@@ -7218,7 +7221,10 @@ static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int re
for (i=0; i < width; ++i) {
stbi_uc rgbe[4];
main_decode_loop:
- stbi__getn(s, rgbe, 4);
+ if (!stbi__getn(s, rgbe, 4)) {
+ STBI_FREE(hdr_data);
+ return stbi__errpf("invalid decoded scanline length", "corrupt HDR");
+ }
stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
}
}

View File

@ -166,6 +166,15 @@ Patch: 1534.patch
# Wild address read in stbi__gif_load_next (GHSL-2023-145/CVE-2023-45661)
# https://github.com/nothings/stb/issues/1538
Patch: 1539.patch
# Fix disclosure of uninitialized memory in stbi__tga_load
# https://github.com/nothings/stb/pull/1543
#
# Fixes:
#
# Disclosure of uninitialized memory in stbi__tga_load
# (GHSL-2023-147/CVE-2023-45663)
# https://github.com/nothings/stb/issues/1542
Patch: %{url}/pull/1543.patch
# Fix double-free in stbi__load_gif_main_outofmem
# https://github.com/nothings/stb/pull/1545
@ -933,6 +942,9 @@ EOF
%changelog
* Tue Feb 27 2024 peijiankang <peijiankang@kylinos.cn> - 0.20220908git8b5f1f3-0.7
- stb_image: fix GHSL-2023-147 / fix CVE-2023-45663
* Thu Nov 23 2023 douyan <douyan@kylinos.cn> - 0.20220908git8b5f1f3-0.8
- add patch 0001-Fix-double-free-in-stbi__load_gif_main_outofmem.patch fix CVE-2023-45664