We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2835bb3 commit b20c9dbCopy full SHA for b20c9db
src/c2pa/c2pa.py
@@ -1388,8 +1388,8 @@ def wrapped_callback(
1388
if data_len > 1024 * 1024: # 1MB limit
1389
return -1
1390
1391
- # Convert C pointer to Python bytes
1392
- data = bytes(data_ptr[:data_len])
+ # Convert C pointer to Python bytes using direct memory access
+ data = bytes(ctypes.cast(data_ptr, ctypes.POINTER(ctypes.c_ubyte * data_len)).contents)
1393
if not data:
1394
# Error: empty data, invalid so return -1,
1395
# native code will also handle it!
0 commit comments