protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.37k stars 15.46k forks source link

python: invalid uint32_t value convertion #16674

Closed alxn1 closed 4 weeks ago

alxn1 commented 5 months ago

Version: 27.0-rc1 (and older versions, up to 624d29d commit, but maybe i'm wrong). Language: Python OS: Linux Python 3.11, protobuf installed from pip with --cpp_implementation flag

Big uint32_t values from protobuf (encoded by C++ code) from python side is are negative And problem is here: PyLong_FromSsize_t should be replaced by PyLong_FromUnsignedLong (or PyLong_FromSize_t, i'm not sure).

anandolee commented 4 months ago

Thank you Alexander to raise it up. Can you help to give an example code to show the bug?

alxn1 commented 4 months ago

I'm sorry, i did forget about one thing: it's but affects only 32-bit platforms like i386/arm32 :( But i did reproduce it with simple examples and little bit of docker magic: protobuf_bug_example.tar.gz This archive contains simple C++ message generator and python message parser which check parsed uint32 value from message; Dockerfile for environment build and run.sh, which run all this stuff properly.

github-actions[bot] commented 1 month ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.

github-actions[bot] commented 4 weeks ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.