Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: invalid uint32_t value convertion #16674

Open
alxn1 opened this issue Apr 30, 2024 · 2 comments
Open

python: invalid uint32_t value convertion #16674

alxn1 opened this issue Apr 30, 2024 · 2 comments
Assignees
Labels

Comments

@alxn1
Copy link

alxn1 commented Apr 30, 2024

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).

@alxn1 alxn1 added the untriaged auto added to all issues by default when created. label Apr 30, 2024
@alxn1 alxn1 changed the title python: invalid uint32_t value converion python: invalid uint32_t value convertion Apr 30, 2024
@zhangskz zhangskz added python and removed untriaged auto added to all issues by default when created. labels May 1, 2024
@anandolee
Copy link
Contributor

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

@alxn1
Copy link
Author

alxn1 commented May 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants