Skip to content

Commit 4fa8f66

Browse files
committed
fix: 2 other lcoations identified
1 parent 347522a commit 4fa8f66

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/c2pa/c2pa.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,10 +2330,8 @@ def _create_reader(self, format_bytes, stream_obj,
23302330
else:
23312331
if not isinstance(manifest_data, bytes):
23322332
raise TypeError(Reader._ERROR_MESSAGES['manifest_error'])
2333-
manifest_array = (
2334-
ctypes.c_ubyte *
2335-
len(manifest_data))(
2336-
*manifest_data)
2333+
manifest_array = (ctypes.c_ubyte * len(manifest_data)).from_buffer_copy(
2334+
manifest_data)
23372335
self._handle = (
23382336
_lib.c2pa_reader_from_manifest_data_and_stream(
23392337
format_bytes,
@@ -2416,10 +2414,8 @@ def _init_from_context(self, context, format_or_path,
24162414
raise TypeError(
24172415
Reader._ERROR_MESSAGES[
24182416
'manifest_error'])
2419-
manifest_array = (
2420-
ctypes.c_ubyte *
2421-
len(manifest_data))(
2422-
*manifest_data)
2417+
manifest_array = (ctypes.c_ubyte * len(manifest_data)).from_buffer_copy(
2418+
manifest_data)
24232419
# Consume current reader,
24242420
# with manifest data and stream (C FFI pattern),
24252421
# to create a new one (switch out)

0 commit comments

Comments
 (0)