Skip to content

Commit 38c5b84

Browse files
committed
stb_image.h: apply mainstream PR/1736
Fix root-cause of CVE-2021-45340 : dereference of NULL ptr. Patch authored by Henner Zeller <[email protected]> Mainstream pull request: nothings/stb#1736 (cherry picked from commit d345579)
1 parent 9da3776 commit 38c5b84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/stb_image.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ RECENT REVISION HISTORY:
100100
Bug & warning fixes
101101
Marc LeBlanc David Woo Guillaume George Martins Mozeiko
102102
Christpher Lloyd Jerry Jansson Joseph Thomson Blazej Dariusz Roszkowski
103-
Phil Jordan Dave Moore Roy Eltham
103+
Phil Jordan Henner Zeller Dave Moore Roy Eltham
104104
Hayaki Saito Nathan Reed Won Chun
105105
Luke Graham Johan Duparc Nick Verigakis the Horde3D community
106106
Thomas Ruf Ronny Chevalier github:rlyeh
@@ -1895,6 +1895,7 @@ static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int r
18951895
int i,j;
18961896
unsigned char *good;
18971897

1898+
if (data == NULL) return data;
18981899
if (req_comp == img_n) return data;
18991900
STBI_ASSERT(req_comp >= 1 && req_comp <= 4);
19001901

0 commit comments

Comments
 (0)