Fix null pointer dereference in stb_image

https://github.com/nothings/stb/issues/1452
This commit is contained in:
Benjamin A. Beasley 2023-02-25 09:23:23 -05:00
parent e46eff5325
commit b0c5c6bad2
2 changed files with 28 additions and 0 deletions

24
1454.patch Normal file
View File

@ -0,0 +1,24 @@
From 4e58258d8c434111fe2e8f1146ae0a72b0e8c554 Mon Sep 17 00:00:00 2001
From: Neil Bickford <nbickford@nvidia.com>
Date: Sat, 25 Feb 2023 05:13:25 -0800
Subject: [PATCH] Fix nullptr dereference when a PIC file causes
stbi__pic_load_core to return 0, and the requested number of components to
stbi_load_from_memory is not 0 or 4
---
stb_image.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stb_image.h b/stb_image.h
index 5e807a0a6..7e6ddeefd 100644
--- a/stb_image.h
+++ b/stb_image.h
@@ -6527,7 +6527,7 @@ static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_c
if (!stbi__pic_load_core(s,x,y,comp, result)) {
STBI_FREE(result);
- result=0;
+ return 0;
}
*px = x;
*py = y;

View File

@ -63,6 +63,10 @@ Patch: %{url}/pull/1198.patch
# patch shows it to be correct.
Patch: %{url}/pull/1236.patch
# Fixes null pointer dereference in https://github.com/nothings/stb/issues/1452
# https://github.com/nothings/stb/pull/1454
Patch: %{url}/pull/1454.patch
%global stb_c_lexer_version 0.12
%global stb_connected_components_version 0.96
%global stb_divide_version 0.94