Skip to content

bpo-30245: possible overflow when organize struct.pack_into error message #1682

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

Merged
merged 10 commits into from
Jun 2, 2017

Conversation

johanliu
Copy link
Contributor

I just try to extend the huge sum from signed long to unsigned long in order to print it without showing overflowed effect.

I suppose it works as expected since you can't make a buffer which size is larger than sys.maxsize. so as before, it make sense.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@mention-bot
Copy link

@johanliu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mdickinson, @serhiy-storchaka and @Yhg1s to be potential reviewers.

@@ -1929,11 +1929,15 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames

/* Check boundaries */
if ((buffer.len - offset) < soself->s_size) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these empty lines. They look distracting.

regex = (
"pack_into requires a buffer of at least " + str(sys.maxsize + 4) +
" bytes for packing 4 bytes at offset " + str(sys.maxsize) +
" \(actual buffer size is 10\)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use raw string literals. Compiling "\(" emits a deprecation warning.

You also could use classic string formatting, string's format() method, or f-string expression for composing this string.

Misc/ACKS Outdated
@@ -1746,3 +1746,4 @@ evilzero
Dhushyanth Ramasamy
Subhendu Ghosh
Sanjay Sundaresan
Yuan Liu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names are sorted in roughly alphabetical order. Thus your name should be about letter L or Y (don't know what of names is a surname).

@Mariatta
Copy link
Member

@johanliu Your PR looks good. Have you signed the CLA? We can't accept the PR until it is signed.
Thank you.

@johanliu
Copy link
Contributor Author

johanliu commented May 27, 2017 via email

@Mariatta
Copy link
Member

Mariatta commented Jun 1, 2017

Thanks @johanliu Looks like your CLA form has been received.
If you can resolve the conflict then I think this PR is ready for merge.

@zhangyangyu zhangyangyu merged commit aead53b into python:master Jun 2, 2017
@johanliu johanliu deleted the issue30245 branch June 2, 2017 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants