LibRaw/CVE-2025-43964.patch
starlet-dx b9ed394d26 Fix CVE-2025-43961,CVE-2025-43962 and CVE-2025-43964
(cherry picked from commit 0f636aae2497b96525f9ffd96c62cd82cbe8667c)
2025-05-06 09:50:10 +08:00

23 lines
901 B
Diff

From: Alex Tutubalin <lexa@lexa.ru>
Date: Sun, 2 Mar 2025 11:35:43 +0300
Subject: additional checks in PhaseOne correction tag 0x412 processing
(cherry picked from commit a50dc3f1127d2e37a9b39f57ad9bb2ebb60f18c0)
---
src/decoders/load_mfbacks.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/decoders/load_mfbacks.cpp b/src/decoders/load_mfbacks.cpp
index 61eedeb..db0dc74 100644
--- a/src/decoders/load_mfbacks.cpp
+++ b/src/decoders/load_mfbacks.cpp
@@ -336,6 +336,8 @@ int LibRaw::phase_one_correct()
unsigned w0 = head[1] * head[3], w1 = head[2] * head[4];
if (w0 > 10240000 || w1 > 10240000)
throw LIBRAW_EXCEPTION_ALLOC;
+ if (w0 < 1 || w1 < 1)
+ throw LIBRAW_EXCEPTION_IO_CORRUPT;
yval[0] = (float *)calloc(head[1] * head[3] + head[2] * head[4], 6);
merror(yval[0], "phase_one_correct()");
yval[1] = (float *)(yval[0] + head[1] * head[3]);