105 Commits

Author SHA1 Message Date
Raymond Hettinger
75ee9eb9c6 Issue #3116 and #1792: Fix quadratic behavior in marshal.dumps(). 2008-06-16 01:49:18 +00:00
Neal Norwitz
163048ed12 Backport 58424:
Fix Coverity 185-186:  If the passed in FILE is NULL, uninitialized memory
would be accessed.
2007-10-12 03:59:09 +00:00
Neal Norwitz
ce15dce421 Drop the max stack depth to something that works in 2.6 2007-05-18 05:12:22 +00:00
Neal Norwitz
dc78cc6f7c Fix bug in marshal where bad data would cause a segfault due to
lack of an infinite recursion check.

Contributed by Damien Miller at Google.
2007-05-16 20:09:36 +00:00
Armin Rigo
4b63c21d6f Forward-port of r52136: a review of overflow-detecting code.
* 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.

* 2.5 specific: fixed a number of places that were still confusing int
  and Py_ssize_t.  Some of them could potentially have caused
  "real-world" breakage.

* list.pop(x): fixing overflow issues on x was messy.  I just reverted
  to PyArg_ParseTuple("n"), which does the right thing.  (An obscure
  test was trying to give a Decimal to list.pop()... doesn't make
  sense any more IMHO)

* trying to write a few tests...
2006-10-04 11:44:06 +00:00
Neal Norwitz
edb2168079 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.

Klocwork # 292.
2006-08-12 01:47:59 +00:00
Georg Brandl
bf92f46572 Convert more modules to METH_VARARGS. 2006-05-29 21:58:42 +00:00
Martin v. Löwis
725507b52e Change int to Py_ssize_t in several places.
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
2006-03-07 12:08:51 +00:00
Thomas Wouters
695934a0ef Make Py_ssize_t clean. 2006-03-01 23:49:13 +00:00
Thomas Wouters
7464b43e41 Fix incompatible assignment warning from previous checkin. 2006-03-01 22:34:09 +00:00
Thomas Wouters
7f401ef73d Fix gcc (4.0.x) warning about use of uninitialized variables.
(PyMarshal_ReadShortFromFile() is only used in zipimport.c, I don't believe
the extra initializations will matter one way or another.)
2006-03-01 22:30:47 +00:00
Martin v. Löwis
67baee6287 Move cast to suppress warning. 2006-02-16 14:37:48 +00:00
Martin v. Löwis
18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Neal Norwitz
1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Neal Norwitz
ef78529e86 version was not initialized properly 2005-11-16 05:04:51 +00:00
Jeremy Hylton
ec97a28b60 Fix a bunch of imports to use code.h instead of compile.h.
Remove duplicate declarations from compile.h
2005-10-21 14:58:06 +00:00
Jeremy Hylton
3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Raymond Hettinger
beb3101b05 Add a C API for sets and frozensets. 2005-08-16 03:47:52 +00:00
Brett Cannon
c9371d4a1b Fix signedness of various char variables to stop causing a warning under gcc 4. 2005-06-25 08:23:41 +00:00
Michael W. Hudson
f2ca5af439 Fix bug
[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff

which I'd assigned to Martin, but actually turned out to be easy to fix.

Also, a test.
2005-06-13 18:28:46 +00:00
Michael W. Hudson
01fca11080 Remove extraneous format character from PyArg_ParseTuple call in
marshal_loads.

Bugfix candidate.
2005-06-13 17:50:18 +00:00
Michael W. Hudson
6d6917be00 Fix a couple of crashing-on-malformed data marshal bugs. 2005-06-03 15:17:16 +00:00
Michael W. Hudson
df88846ebc This is my patch:
[ 1180995 ] binary formats for marshalling floats

Adds 2 new type codes for marshal (binary floats and binary complexes), a
new marshal version (2), updates MAGIC and fiddles the de-serializing of
code objects to be less likely to clobber the real reason for failing if
it fails.
2005-06-03 14:41:55 +00:00
Fred Drake
d7c27bef52 remove unused variable 2005-01-12 16:00:55 +00:00
Raymond Hettinger
a422c34b70 SF 1098985: set objects cannot be marshalled 2005-01-11 03:03:27 +00:00