backport fix for CVE-2023-52339 (#2258048, #2258046)

epel8
Dominik Mierzejewski 1 year ago
parent 3ed16b4d62
commit 6202225dd0

@ -0,0 +1,31 @@
diff -up libebml-1.3.9/src/MemIOCallback.cpp.cve-2023-52339 libebml-1.3.9/src/MemIOCallback.cpp
--- libebml-1.3.9/src/MemIOCallback.cpp.cve-2023-52339 2024-02-02 13:48:28.626522658 +0100
+++ libebml-1.3.9/src/MemIOCallback.cpp 2024-02-02 13:49:59.620078963 +0100
@@ -68,7 +68,8 @@ uint32 MemIOCallback::read(void *Buffer,
if (Buffer == NULL || Size < 1)
return 0;
//If the size is larger than than the amount left in the buffer
- if (Size + dataBufferPos > dataBufferTotalSize) {
+ if (Size + dataBufferPos < Size || // overflow, reading too much
+ Size + dataBufferPos > dataBufferTotalSize) {
//We will only return the remaining data
memcpy(Buffer, dataBuffer + dataBufferPos, dataBufferTotalSize - dataBufferPos);
uint64 oldDataPos = dataBufferPos;
@@ -95,6 +96,8 @@ void MemIOCallback::setFilePointer(int64
size_t MemIOCallback::write(const void *Buffer, size_t Size)
{
+ if (dataBufferPos + Size < Size) // overflow, we can't hold that much
+ return 0;
if (dataBufferMemorySize < dataBufferPos + Size) {
//We need more memory!
dataBuffer = (binary *)realloc((void *)dataBuffer, dataBufferPos + Size);
@@ -109,6 +112,8 @@ size_t MemIOCallback::write(const void *
uint32 MemIOCallback::write(IOCallback & IOToRead, size_t Size)
{
+ if (dataBufferPos + Size < Size) // overflow, we can't hold that much
+ return 0;
if (dataBufferMemorySize < dataBufferPos + Size) {
//We need more memory!
dataBuffer = (binary *)realloc((void *)dataBuffer, dataBufferPos + Size);

@ -1,11 +1,13 @@
Summary: Extensible Binary Meta Language library
Name: libebml
Version: 1.3.9
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
URL: https://www.matroska.org/
Source: https://dl.matroska.org/downloads/%{name}/%{name}-%{version}.tar.xz
Patch0: %{name}-use-system-utf8cpp.patch
# https://github.com/Matroska-Org/libebml/pull/148
Patch1: %{name}-cve-2023-52339.patch
BuildRequires: cmake3
BuildRequires: gcc-c++
BuildRequires: utf8cpp-devel
@ -34,6 +36,7 @@ will use the Extensible Binary Meta Language library.
%prep
%setup -q
%patch0 -p1 -b .utf8cpp
%patch1 -p1 -b .cve-2023-52339
rm -r src/lib/utf8-cpp
@ -66,6 +69,9 @@ make %{?_smp_mflags}
%changelog
* Fri Feb 02 2024 Dominik Mierzejewski <rpm@greysector.net> - 1.3.9-2
- backport fix for CVE-2023-52339 (#2258048, #2258046)
* Tue Sep 10 2019 Dominik Mierzejewski <rpm@greysector.net> - 1.3.9-1
- update to 1.3.9 (#1688001)

Loading…
Cancel
Save