Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

tinyexr: Fix heap OOB read in multipart header parsing

Rémi Verschelde3e7eda1f0838
diff --git a/thirdparty/README.md b/thirdparty/README.md
index cbabe51a514..2e2423a07ed 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -1137,6 +1137,7 @@ Files extracted from upstream source:
Patches:
- `0001-external-zlib.patch` ([GH-55115](https://github.com/godotengine/godot/pull/55115))
+- `0002-fix-multipart-header-stale-size.patch` ([GH-124638](https://github.com/godotengine/godot/pull/124638))
## ufbx
diff --git a/thirdparty/tinyexr/patches/0002-fix-multipart-header-stale-size.patch b/thirdparty/tinyexr/patches/0002-fix-multipart-header-stale-size.patch
new file mode 100644
index 00000000000..fb434d6a7c2
--- /dev/null
+++ b/thirdparty/tinyexr/patches/0002-fix-multipart-header-stale-size.patch
@@ -0,0 +1,16 @@
+Custom fix for CVE-2026-110597 to appease distro maintainers.
+We don't actually use that code in Godot.
+
+diff --git a/thirdparty/tinyexr/tinyexr.h b/thirdparty/tinyexr/tinyexr.h
+index 7a3948d107..5c96a1a149 100644
+--- a/thirdparty/tinyexr/tinyexr.h
++++ b/thirdparty/tinyexr/tinyexr.h
+@@ -10617,7 +10617,7 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers,
+
+ // move to next header.
+ marker += info.header_len;
+- size -= info.header_len;
++ marker_size -= info.header_len;
+ }
+
+ // allocate memory for EXRHeader and create array of EXRHeader pointers.
diff --git a/thirdparty/tinyexr/tinyexr.h b/thirdparty/tinyexr/tinyexr.h
index 7a3948d1073..5c96a1a1498 100644
--- a/thirdparty/tinyexr/tinyexr.h
+++ b/thirdparty/tinyexr/tinyexr.h
@@ -10617,7 +10617,7 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers,
// move to next header.
marker += info.header_len;
- size -= info.header_len;
+ marker_size -= info.header_len;
}
// allocate memory for EXRHeader and create array of EXRHeader pointers.