Closed bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 closed 23 years ago
We'll have to trust Trent that this works on 64-bit Windows...
OK. Note that the chakge to id() means that id() can now return a long -- this should normally be alright but it's possible that it could break code that expects an int. Good enough for a beta.
I confirm that, to the best of my knowledge and belief, this contribution is free of any claims of third parties under copyright, patent or other rights or interests ("claims"). To the extent that I have any such claims, I hereby grant to CNRI a nonexclusive, irrevocable, royalty-free, worldwide license to reproduce, distribute, perform and/or display publicly, prepare derivative versions, and otherwise use this contribution as part of the Python software and its related documentation, or any derivative versions thereof, at no cost to CNRI or its licensed users, and to authorize others to do so.
I acknowledge that CNRI may, at its sole discretion, decide whether or not to incorporate this contribution in the Python software and its related documentation. I further grant CNRI permission to use my name and other identifying information provided to CNRI by me for use in connection with the Python software and its related documentation.
Various small fixes to the builtin module to ensure no buffer overflows.
chunk #1: Proper casting to ensure no truncation, and hence no surprises, in the comparison.
chunk #2: The id() function guarantees a unique return value for different objects. It does this by returning the pointer to the object. By returning a PyInt, on Win64 (sizeof(long) \< sizeof(void*)) the pointer is truncated and the guarantee may be proven false. The appropriate return function is PyLong_FromVoidPtr, this returns a PyLong if that is necessary to return the pointer without truncation.
chunk #3: Ensure no overflow in raw_input(). Granted the user would have to pass in >2GB of data but it *is* a possible buffer overflow condition.
Muuwaaaahhhaaaa! -- member of live 32-bits or die
p.s. But, as a theoretical exercise, this looks okay to you I presume.
Note that the chakge to id() means that id() can now return a long -- this should normally be alright but it's possible that it could break code that expects an int
Yes, I asked Tim about that and he said, correctly, that the guarantee is only that an integral value is returned and that PyLong qualifies.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = 'https://github.com/gvanrossum' closed_at =
created_at =
labels = []
title = 'fix bltinmodule.c for 64-bit platforms'
updated_at =
user = 'https://bugs.python.org/tmick'
```
bugs.python.org fields:
```python
activity =
actor = 'tmick'
assignee = 'gvanrossum'
closed = True
closed_date = None
closer = None
components = ['None']
creation =
creator = 'tmick'
dependencies = []
files = ['2449']
hgrepos = []
issue_num = 400518
keywords = ['patch']
message_count = 7.0
messages = ['32761', '32762', '32763', '32764', '32765', '32766', '32767']
nosy_count = 2.0
nosy_names = ['gvanrossum', 'tmick']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue400518'
versions = []
```