Details: https://nvd.nist.gov/vuln/detail/CVE-2023-52389

Pick the patch from the PR mentioned in the nvd report.

Signed-off-by: Gyorgy Sarvari <[email protected]>
---
 .../poco/poco/CVE-2023-52389.patch            | 122 ++++++++++++++++++
 meta-oe/recipes-support/poco/poco_1.11.2.bb   |   1 +
 2 files changed, 123 insertions(+)
 create mode 100644 meta-oe/recipes-support/poco/poco/CVE-2023-52389.patch

diff --git a/meta-oe/recipes-support/poco/poco/CVE-2023-52389.patch 
b/meta-oe/recipes-support/poco/poco/CVE-2023-52389.patch
new file mode 100644
index 0000000000..1121caa7b0
--- /dev/null
+++ b/meta-oe/recipes-support/poco/poco/CVE-2023-52389.patch
@@ -0,0 +1,122 @@
+From 260963fc7bdc4f11611eee48483c2153fea33326 Mon Sep 17 00:00:00 2001
+From: Andrei Fedotov <[email protected]>
+Date: Wed, 20 Dec 2023 16:29:17 +0300
+Subject: [PATCH] Fix Integer overflow in Poco::UTF32Encoding
+
+CVE: CVE-2023-52389
+Upstream-Status: Backport 
[https://github.com/ClickHouse/ClickHouse/commit/341806d44017a9c9fff3b4872e3eec40acf014d2]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ Foundation/include/Poco/UTF32Encoding.h | 10 ++++++
+ Foundation/src/UTF32Encoding.cpp        | 42 ++++++++++++-------------
+ 2 files changed, 31 insertions(+), 21 deletions(-)
+
+diff --git a/Foundation/include/Poco/UTF32Encoding.h 
b/Foundation/include/Poco/UTF32Encoding.h
+index 6f8af525a..251c084d2 100644
+--- a/Foundation/include/Poco/UTF32Encoding.h
++++ b/Foundation/include/Poco/UTF32Encoding.h
+@@ -68,6 +68,16 @@ public:
+       int convert(int ch, unsigned char* bytes, int length) const;
+       int queryConvert(const unsigned char* bytes, int length) const;
+       int sequenceLength(const unsigned char* bytes, int length) const;
++
++protected:
++      static int safeToInt(Poco::UInt32 value)
++      {
++              if (value <= 0x10FFFF)
++                      return static_cast<int>(value);
++              else
++                      return -1;
++      }
++
+       
+ private:
+       bool _flipBytes;
+diff --git a/Foundation/src/UTF32Encoding.cpp 
b/Foundation/src/UTF32Encoding.cpp
+index 47a0156b0..dd27c3434 100644
+--- a/Foundation/src/UTF32Encoding.cpp
++++ b/Foundation/src/UTF32Encoding.cpp
+@@ -30,22 +30,22 @@ const char* UTF32Encoding::_names[] =
+ 
+ const TextEncoding::CharacterMap UTF32Encoding::_charMap =
+ {
+-      /* 00 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 10 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 20 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 30 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 40 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 50 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 60 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 70 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 80 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* 90 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* a0 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* b0 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* c0 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* d0 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* e0 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
+-      /* f0 */        -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 
-2, -2,
++      /* 00 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 10 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 20 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 30 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 40 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 50 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 60 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 70 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 80 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* 90 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* a0 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* b0 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* c0 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* d0 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* e0 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
++      /* f0 */        -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 
-4, -4,
+ };
+ 
+ 
+@@ -118,7 +118,7 @@ const TextEncoding::CharacterMap& 
UTF32Encoding::characterMap() const
+ int UTF32Encoding::convert(const unsigned char* bytes) const
+ {
+       UInt32 uc;
+-      unsigned char* p = (unsigned char*) &uc;
++      unsigned char* p = reinterpret_cast<unsigned char*>(&uc);
+       *p++ = *bytes++;
+       *p++ = *bytes++;
+       *p++ = *bytes++;
+@@ -129,7 +129,7 @@ int UTF32Encoding::convert(const unsigned char* bytes) 
const
+               uc = ByteOrder::flipBytes(uc);
+       }
+ 
+-      return uc;
++      return safeToInt(uc);
+ }
+ 
+ 
+@@ -138,7 +138,7 @@ int UTF32Encoding::convert(int ch, unsigned char* bytes, 
int length) const
+       if (bytes && length >= 4)
+       {
+               UInt32 ch1 = _flipBytes ? ByteOrder::flipBytes((UInt32) ch) : 
(UInt32) ch;
+-              unsigned char* p = (unsigned char*) &ch1;
++              unsigned char* p = reinterpret_cast<unsigned char*>(&ch1);
+               *bytes++ = *p++;
+               *bytes++ = *p++;
+               *bytes++ = *p++;
+@@ -155,7 +155,7 @@ int UTF32Encoding::queryConvert(const unsigned char* 
bytes, int length) const
+       if (length >= 4)
+       {
+               UInt32 uc;
+-              unsigned char* p = (unsigned char*) &uc;
++              unsigned char* p = reinterpret_cast<unsigned char*>(&uc);
+               *p++ = *bytes++;
+               *p++ = *bytes++;
+               *p++ = *bytes++;
+@@ -164,7 +164,7 @@ int UTF32Encoding::queryConvert(const unsigned char* 
bytes, int length) const
+               {
+                       uc = ByteOrder::flipBytes(uc);
+               }
+-              return uc;
++              return safeToInt(uc);
+       }
+ 
+       return ret;
diff --git a/meta-oe/recipes-support/poco/poco_1.11.2.bb 
b/meta-oe/recipes-support/poco/poco_1.11.2.bb
index b8a1b571b1..f5332aaf27 100644
--- a/meta-oe/recipes-support/poco/poco_1.11.2.bb
+++ b/meta-oe/recipes-support/poco/poco_1.11.2.bb
@@ -12,6 +12,7 @@ SRC_URI = 
"git://github.com/pocoproject/poco.git;branch=main;protocol=https \
            file://run-ptest \
            file://CVE-2025-6375.patch \
            
file://0001-fix-test-Use-96-bit-IV-with-aes-256-gcm-to-fix-4347.patch \
+           file://CVE-2023-52389.patch \
            "
 SRCREV = "9d1c428c861f2e5ccf09149bbe8d2149720c5896"
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#121978): 
https://lists.openembedded.org/g/openembedded-devel/message/121978
Mute This Topic: https://lists.openembedded.org/mt/116424276/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to