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

Binary decoding likely has 32bit issues with large data sizes #1377

Closed
thomasvl opened this issue Feb 14, 2023 · 4 comments
Closed

Binary decoding likely has 32bit issues with large data sizes #1377

thomasvl opened this issue Feb 14, 2023 · 4 comments

Comments

@thomasvl
Copy link
Collaborator

Like what #1375 fixed, it looks like we've got a few cases (getFieldBodyBytes(count:), consume(length:), ...) where because the internals of the BinaryDecoder use Int we could have failures in a 32bit build.

@thomasvl
Copy link
Collaborator Author

fyi - The C++ upstream code seem to use INT_MAX in some cased to catch limits, but it seems like that value will change depending on a build being for a 64 or 32 bit platform. And the new https://protobuf.dev/programming-guides/encoding/#cheat-sheet section calls out some 2GB limits on specific things.

@thomasvl
Copy link
Collaborator Author

Correction on that comment - int (and INT_MAX) is still 32bit on most 64bit systems: https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models

@tbkka
Copy link
Collaborator

tbkka commented Feb 14, 2023

If there's a 2GB limit, we should still write it out as 0xffffffff or similar.

@thomasvl
Copy link
Collaborator Author

I'm going to go ahead and close this, I doing another pass, and don't immediately see issues, so at this point I'd suggest we treat them as bugs if found instead of keeping this open longer term without any clear next steps.

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

No branches or pull requests

2 participants