Ronald Oussoren [Sun, 8 Oct 2006 17:41:25 +0000 (17:41 +0000)]
Port of universal binary support for Mac OSX from python 2.5. This takes away
the need for the out-of-tree universal binary support that was used to build
the 2.4.3 installer.
Missing here relative to that tree are some changes to IDLE, IMHO those patches
aren't appropriate for the 2.4 branch and users are better of using 2.5's IDLE.
Prevent an invalid memory read from test_coding in case the done flag is set.
In that case, the loop isn't entered. I wonder if rather than setting
the done flag in the cases before the loop, if they should just exit early.
This code looks like it should be refactored.
Backport candidate (also the early break above if decoding_fgets fails)
[Backport r51222 | neal.norwitz -- if you hack the code to set r=NULL,
you find that Python does print "MemoryError". There's no traceback
and no indication of which line of code is responsible, but it's
better than a segfault.]
Handle NULL nodes while parsing. I'm not entirely sure this is correct.
There might be something else that needs to be done to setup the error.
[Backport r51221 | neal.norwitz -- the original commit message is wrong;
this code is only used if WITHOUT_COMPLEX is *not* defined, which is the
common case for Python builds.]
This code is actually not used unless WITHOUT_COMPLEX is defined.
However, there was no error checking that PyFloat_FromDouble returned
a valid pointer. I believe this change is correct as it seemed
to follow other code in the area.
v2 can be NULL if exception2 is NULL. I don't think that condition can happen,
but I'm not sure it can't either. Now the code will protect against either
being NULL.
[Backport r50783 | neal.norwitz. The bytes_left code is complicated,
but looks correct on a casual inspection and hasn't been modified
in the trunk. Does anyone want to review further?]
Ensure we don't write beyond errText. I think I got this right, but
it definitely could use some review to ensure I'm not off by one
and there's no possible overflow/wrap-around of bytes_left.
Reported by Klocwork #1.
Fix a problem if there is a failure allocating self->db.
Found with failmalloc.
[Partial backport of r51218 | neal.norwitz -- the changes to ast.c, symtable.c,
and _elementtree.c weren't applicable]
Klocwork made another run and found a bunch more problems.
This is the first batch of fixes that should be easy to verify based on context.
This fixes problem numbers: 220 (ast), 323-324 (symtable),
321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
Cause a PyObject_Malloc() failure to trigger a MemoryError, and then
add 'if (PyErr_Occurred())' checks to various places so that NULL is
returned properly.
If _stat_float_times is false, we will try to INCREF ival which could be NULL.
Return early in that case. The caller checks for PyErr_Occurred so this
should be ok.
Try to handle a malloc failure. I'm not entirely sure this is correct.
There might be something else we need to do to handle the exception.
Klocwork # 212-213
[I think this needs more work; a malloc() failure will cause a match to fail,
but nothing raises MemoryError. I'll work on this on the trunk and backport.
--amk]
I'm not sure why this code allocates this string for the error message.
I think it would be better to always use snprintf and have the format
limit the size of the name appropriately (like %.200s).
Armin Rigo [Wed, 4 Oct 2006 10:13:32 +0000 (10:13 +0000)]
A review of overflow-detecting code in the 2.4 branch.
* unified the way intobject, longobject and mystrtoul handle
values around -sys.maxint-1.
* in general, trying to entierely avoid overflows in any computation
involving signed ints or longs is extremely involved. Fixed a few
simple cases where a compiler might be too clever (but that's all
guesswork).
* more overflow checks against bad data in marshal.c.
It's very unlikely, though possible that source is not a string. Verify
that PyString_AsString() returns a valid pointer. (The problem can
arise when zlib.decompress doesn't return a string.)
Georg Brandl [Sat, 30 Sep 2006 08:43:35 +0000 (08:43 +0000)]
Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
(backport from rev. 52058)
Since I can't test this, I'm just adding a comment. If we get access
to AIX boxes, we can test this and really resolve. Anyone from IBM
want to offer help?
[ 1232517 ] OverflowError in time.utime() causes strange traceback
A needed error check was missing.
(Actually, this error check may only have become necessary in fairly
recent Python, not sure).
Backport candidate.
[A few lines below the code in 2.4 touched by the patch, there's already
a similar check of (intval == -1 && PyErr_Occurred()), so I think
this function can already report such errors, and therefore the fix
still applies. Perhaps Michael can clarify what he was referring to. --amk]
[Possibly controversial because it adds a parameter to a method.
This parameter isn't documented, however, so arguably it's a private
detail, and the fix is necessary to make GzipFile.flush() behave more
similarly to regular file object.]
Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
Partially fixes #1110242.
Fixed a few bugs on cjkcodecs:
- gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly.
- iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312
codepoints to conform the standard.
- iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 0213:2
codepoints now.
Tim Peters [Tue, 5 Sep 2006 02:00:47 +0000 (02:00 +0000)]
Merge rev 51711 from the 2.5 branch.
i_divmod(): As discussed on Python-Dev, changed the overflow
checking to live happily with recent gcc optimizations that
assume signed integer arithmetic never overflows.
Thomas Wouters [Thu, 24 Aug 2006 18:55:01 +0000 (18:55 +0000)]
Backport trunk's revision 51565:
Fix SF bug #1545837: array.array borks on deepcopy.
array.__deepcopy__() needs to take an argument, even if it doesn't actually
use it. Will backport to 2.5 and 2.4 (if applicable.)