python3-cbor2: more patch indent and test fixes

Similar to a previous patch, the CVE-2025-68131 patch
contained some more indentation errors, in the tests.

Also, the backported tests were inserted between an
existing test and its parameters - a new patch corrects
that.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
This commit is contained in:
Gyorgy Sarvari
2026-04-13 17:22:51 +02:00
parent 5fcddafe23
commit 6971622747
3 changed files with 53 additions and 4 deletions
@@ -411,7 +411,7 @@ index d03e288..cc3af11 100644
+ decoder.decode_from_bytes(msg2)
+
+ def test_shared_refs_within_single_decode(self, impl):
+ """
+ """
+ Shared references must work correctly within a single decode operation.
+
+ Note: This tests non-cyclic sibling references [shareable(x), sharedref(0)],
@@ -420,7 +420,7 @@ index d03e288..cc3af11 100644
+ """
+ # [shareable("hello"), sharedref(0)] -> ["hello", "hello"]
+ data = unhexlify(
+ "82" # array(2)
+ "82" # array(2)
+ "d81c" # tag(28) shareable
+ "65" # text(5)
+ "68656c6c6f" # "hello"
@@ -475,7 +475,7 @@ index 8c40000..c76d5e0 100644
+ encode_to_bytes should also reset shared container tracking between calls.
+ """
+ fp = BytesIO()
+ encoder = impl.CBOREncoder(fp, value_sharing=True)
+ encoder = impl.CBOREncoder(fp, value_sharing=True)
+ shared_obj = ["hello"]
+
+ # First encode
@@ -483,7 +483,7 @@ index 8c40000..c76d5e0 100644
+
+ # Second encode should produce valid standalone CBOR
+ result_bytes = encoder.encode_to_bytes(shared_obj)
+ result = impl.loads(result_bytes)
+ result = impl.loads(result_bytes)
+ assert result == ["hello"]
+
+ def test_encoder_hook_does_not_reset_state(self, impl):