SHA256
1
0
forked from pool/python-cbor2

16 Commits

Author SHA256 Message Date
6fe546da81 Merge remote-tracking branch 'origin/slfo-main' into CVE-2025-64076 2025-11-24 16:54:21 +01:00
86be5cbd3a Add CVE-2025-64076.patch from upstream
Fix: bug in decode_definite_long_string() that causes incorrect chunk
length calculation.

bsc#1253746, CVE-2025-64076, gh#agronholm/cbor2#265
2025-11-19 12:02:31 +01:00
1ad01979cd Convert to libalternatives, bsc#1245883 2025-11-03 14:40:09 +01:00
0c6379bf3c Accepting request 1217046 from devel:languages:python
- update to 5.6.5:
  * Published binary wheels for Python 3.13

OBS-URL: https://build.opensuse.org/request/show/1217046
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=13
2024-10-23 19:09:46 +00:00
6f747eba62 - update to 5.6.5:
* Published binary wheels for Python 3.13

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cbor2?expand=0&rev=27
2024-10-22 13:48:05 +00:00
4e4816b20e Accepting request 1179021 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1179021
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=12
2024-06-07 13:03:25 +00:00
efb2683975 Accepting request 1133371 from devel:languages:python
- update to 5.5.1:
  * Fixed ``CBORSimpleValue`` allowing the use of reserved values
    (24 to 31) which resulted in invalid byte sequences
  * Fixed encoding of simple values from 20 to 23 producing the
    wrong byte sequences
  * The ``cbor2.encoder``, ``cbor2.decoder`` or ``cbor2.types``
    modules were deprecated – import their contents directly
    from ``cbor2`` from now on. The old modules will be removed
    in the next major release.
  * Added support for Python 3.12
  * Added type annotations
  * Dropped support for Python 3.7
  * Fixed bug in the ``fp`` attribute of the built-in version of
    ``CBORDecoder`` and ``CBOREncoder`` where the getter returns
    an invalid pointer if the ``read`` method of the file was a
    built-in method

  * Bump requirement to 3.7+
  * Fix segfault when initializing CBORTag with incorrect arguments
  * Fix sphinx build warnings
  * Fix SystemErrors when using C-backend, meaningful exceptions now raised
  * Fix precision loss when decoding base10 decimal fractions
  * Made CBORTag handling consistent between python and C-module
  * Feature: Ignore semantic tag used for file magic 55799 AKA "Self-Described CBOR" (kalcutter)
  * BACKWARD INCOMPATIBLE CBOR does not have a bare DATE type,
  * Optional Pure C implementation by waveform80 that functions

OBS-URL: https://build.opensuse.org/request/show/1133371
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=11
2023-12-15 20:49:53 +00:00
a5a2e035cd Accepting request 1092388 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1092388
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=10
2023-06-12 13:26:25 +00:00
82dd33088a Accepting request 1056835 from devel:languages:python
- update to 5.4.6:
  * Fix tag decoding error
  * fix potential memory leak
  * Bump requirement to 3.7+

OBS-URL: https://build.opensuse.org/request/show/1056835
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=9
2023-01-08 20:25:39 +00:00
afbf1732e4 Accepting request 946692 from devel:languages:python
- update to 5.4.2:
  * Fix segfault when initializing CBORTag with incorrect arguments 
  * Fix sphinx build warnings 
  * Fix SystemErrors when using C-backend, meaningful exceptions now raised 
  * Fix precision loss when decoding base10 decimal fractions 
  * Made CBORTag handling consistent between python and C-module

OBS-URL: https://build.opensuse.org/request/show/946692
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=8
2022-01-16 23:22:47 +00:00
79bf25c878 Accepting request 898419 from devel:languages:python
- update to 5.4.0:
  * Added new feature stringrefs, which makes repetitive dictionary structures
    more compact. Use with care since support for this is rare in other CBOR
    implementations.
  * This release includes some bugfixes around decoding invalid data, which may
    improve security on decoding untrusted data.

OBS-URL: https://build.opensuse.org/request/show/898419
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=7
2021-06-09 19:52:37 +00:00
b02cd08f0c Accepting request 887881 from devel:languages:python
- update to 5.2.0:
  * Final version tested with Python 2.7 and 3.5
  * README: Announce deprecation of Python 2.7, 3.5
  * README: More detail and examples
  * Bugfix: Fix segfault on loading huge arrays with C-backend (Sekenre)
  * Build system: Allow packagers to force C-backend building or disable using env var (jameshilliard)
  * Feature: :module:`cbor2.tool` Command line diagnostic tool (Sekenre)
  * Feature: Ignore semantic tag used for file magic 55799 AKA "Self-Described CBOR" (kalcutter)

OBS-URL: https://build.opensuse.org/request/show/887881
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=6
2021-04-23 15:50:38 +00:00
d568a04ef6 Accepting request 828448 from devel:languages:python
- Update to version 5.1.2
 * Refcount bug in C lib causing intermittent segfaults on shutdown
 * Fractional seconds parsing in datetimes

OBS-URL: https://build.opensuse.org/request/show/828448
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=5
2020-08-21 17:16:19 +00:00
5e07149833 Accepting request 789799 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/789799
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=4
2020-03-30 21:06:46 +00:00
4b1fd5d706 Accepting request 782823 from devel:languages:python
py38 fix

OBS-URL: https://build.opensuse.org/request/show/782823
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=3
2020-03-10 08:51:10 +00:00
ed762196f0 Accepting request 766911 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/766911
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cbor2?expand=0&rev=2
2020-01-25 12:24:31 +00:00
5 changed files with 116 additions and 6 deletions

71
CVE-2025-64076.patch Normal file
View File

@@ -0,0 +1,71 @@
From 851473490281f82d82560b2368284ef33cf6e8f9 Mon Sep 17 00:00:00 2001
From: lizhenghao <sculizhenghao@foxmail.com>
Date: Wed, 22 Oct 2025 10:26:34 +0800
Subject: [PATCH 1/3] Fix: Fixed a read(-1) vulnerability caused by boundary
handling error in #264
---
source/decoder.c | 8 +++++++-
tests/test_decoder.py | 22 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
Index: cbor2-5.6.5/source/decoder.c
===================================================================
--- cbor2-5.6.5.orig/source/decoder.c
+++ cbor2-5.6.5/source/decoder.c
@@ -758,7 +758,7 @@ decode_definite_long_string(CBORDecoderO
char *buffer = NULL;
while (left) {
// Read up to 65536 bytes of data from the stream
- Py_ssize_t chunk_length = 65536 - buffer_size;
+ Py_ssize_t chunk_length = 65536 - buffer_length;
if (left < chunk_length)
chunk_length = left;
@@ -828,7 +828,13 @@ decode_definite_long_string(CBORDecoderO
memcpy(buffer, bytes_buffer + consumed, unconsumed);
}
buffer_length = unconsumed;
+ } else {
+ // All bytes consumed, reset buffer_length
+ buffer_length = 0;
}
+
+ Py_DECREF(chunk);
+ chunk = NULL;
}
if (ret && string_namespace_add(self, ret, length) == -1)
Index: cbor2-5.6.5/tests/test_decoder.py
===================================================================
--- cbor2-5.6.5.orig/tests/test_decoder.py
+++ cbor2-5.6.5/tests/test_decoder.py
@@ -260,6 +260,28 @@ def test_string_oversized(impl) -> None:
(impl.loads(unhexlify("aeaeaeaeaeaeaeaeae0108c29843d90100d8249f0000aeaeffc26ca799")),)
+def test_string_issue_264_multiple_chunks_utf8_boundary(impl) -> None:
+ """Test for Issue #264: UTF-8 characters split across multiple 65536-byte chunk boundaries."""
+ import struct
+
+ # Construct: 65535 'a' + '€' (3 bytes) + 65533 'b' + '€' (3 bytes) + 100 'd'
+ # Total: 131174 bytes, which spans 3 chunks (65536 + 65536 + 102)
+ total_bytes = 65535 + 3 + 65533 + 3 + 100
+
+ payload = b"\x7a" + struct.pack(">I", total_bytes) # major type 3, 4-byte length
+ payload += b"a" * 65535
+ payload += "€".encode() # U+20AC: E2 82 AC
+ payload += b"b" * 65533
+ payload += "€".encode()
+ payload += b"d" * 100
+
+ expected = "a" * 65535 + "€" + "b" * 65533 + "€" + "d" * 100
+
+ result = impl.loads(payload)
+ assert result == expected
+ assert len(result) == 131170 # 65535 + 1 + 65533 + 1 + 100 characters
+
+
@pytest.mark.parametrize(
"payload, expected",
[

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c533c50dde86bef1c6950602054a0ffa3c376e8b0e20c7b8f5b108793f6983e
size 100865

BIN
cbor2-5.6.5.tar.gz LFS Normal file

Binary file not shown.

View File

@@ -1,3 +1,27 @@
-------------------------------------------------------------------
Wed Nov 19 10:56:07 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
- Add CVE-2025-64076.patch from upstream. Fix: bug in
decode_definite_long_string() that causes incorrect chunk length
calculation
(bsc#1253746, CVE-2025-64076, gh#agronholm/cbor2#265)
-------------------------------------------------------------------
Tue Aug 12 08:01:01 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Make the libalternatives transition conditional
-------------------------------------------------------------------
Wed Jun 25 11:44:28 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to libalternatives
-------------------------------------------------------------------
Tue Oct 22 13:48:00 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 5.6.5:
* Published binary wheels for Python 3.13
-------------------------------------------------------------------
Thu Jun 6 10:36:17 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
@@ -10,7 +34,7 @@ Thu Jun 6 10:36:17 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.c
-------------------------------------------------------------------
Wed Jun 5 15:47:30 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 5.6.3
- Update to 5.6.3 (bsc#1220096, CVE-2024-26134):
* Fixed decoding of epoch-based dates being affected by the local
time zone in the C extension
- from version 5.6.2

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-cbor2
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,14 +16,21 @@
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-cbor2
Version: 5.6.4
Version: 5.6.5
Release: 0
Summary: Pure Python CBOR (de)serializer with extensive tag support
License: MIT
URL: https://github.com/agronholm/cbor2
Source: https://files.pythonhosted.org/packages/source/c/cbor2/cbor2-%{version}.tar.gz
# PATCH-FIX-UPSTREAM CVE-2025-64076.patch bsc#1253746 gh#agronholm/cbor2#265
Patch0: CVE-2025-64076.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module pip}
@@ -33,8 +40,13 @@ BuildRequires: %{python_module setuptools_scm >= 6.4}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
%python_subpackages
%description
@@ -60,6 +72,9 @@ export LANG=en_US.UTF8
export LANG=en_US.UTF8
%pytest_arch
%pre
%python_libalternatives_reset_alternative cbor2
%post
%python_install_alternative cbor2