Skip to content

Commit 3eb686f

Browse files
authoredFeb 1, 2025··
apply patch from @hzeller to fix the root cause of CVE-2021-45340 (#40)
* apply patch from @hzeller to fix the root cause of CVE-2021-45340 Signed-off-by: Cocoa <i@uwucocoa.moe>
1 parent 6e797c9 commit 3eb686f

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
mix test
7272
7373
macos:
74-
runs-on: macos-12
74+
runs-on: macos-13
7575
env:
7676
MIX_ENV: test
7777
ELIXIR_VERSION: "1.16.2"

‎3rd_party/stb/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
@@ -1760,6 +1760,7 @@ static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int r
17601760
int i,j;
17611761
unsigned char *good;
17621762

1763+
if (data == NULL) return data;
17631764
if (req_comp == img_n) return data;
17641765
STBI_ASSERT(req_comp >= 1 && req_comp <= 4);
17651766

‎test/stb-issue-cve-2021-45340.gif

13 Bytes
Loading

‎test/stb_image_test.exs

+6
Original file line numberDiff line numberDiff line change
@@ -297,5 +297,11 @@ defmodule StbImageTest do
297297

298298
assert decoded == expected
299299
end
300+
301+
test "CVE-2021-45340" do
302+
assert_raise ArgumentError, "cannot decode image", fn ->
303+
StbImage.read_file!(Path.join(__DIR__, "stb-issue-cve-2021-45340.gif"))
304+
end
305+
end
300306
end
301307
end

0 commit comments

Comments
 (0)
Please sign in to comment.