[issue6344] mmap.read() crashes when passed a negative argument

2009-06-29 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Thanks, committed in r73677(trunk), r73682(release26-maint), r73684(py3k), r73685(release31-maint). -- resolution: -> fixed status: open -> closed ___ Python tracker __

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: OK for me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-29 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: OK, how about this patch? -- Added file: http://bugs.python.org/file14382/fix_mmap_read.patch ___ Python tracker ___

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-28 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > + if (n < 0) I suggest a comment like: /* The difference can overflow, only if self->size is greater than * PY_SSIZE_T_MAX. But then the operation cannot possibly succeed, * because the mapped area and the returned string each need more * than

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-27 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: Hmm, I cannot reproduce the crash. I created the patch experimentally, but I'm not confident with this patch. Especially here + if (n < 0) + n = PY_SSIZE_T_MAX; because I don't have so much memory. -- keywords: +patch Added file

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-26 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Well, I would not care that much: you can never read more than PY_SSIZE_T_MAX, because the mapped area and the string would not fit in the addressable space of the process. -- ___ Python tracker

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-25 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: > I don't know what mf.read(-1) should do I'm not sure neither. I think the problem is that mmap uses size_t as length, but uses Py_ssize_t for PyArg_ParseTuple. (PyArg_ParseTuple doesn't support size_t) I think this discrepancy should be fixed. If mmap sho

[issue6344] mmap.read() crashes when passed a negative argument

2009-06-25 Thread Amaury Forgeot d'Arc
New submission from Amaury Forgeot d'Arc : mmap.read() crashes when passed a negative count: def test_read_negative(self): f = open(TESTFN, 'w+') f.write("ABCDE\0abcde") f.flush() mf = mmap.mmap(f.fileno(), 0) self.assertEqual(mf.read(2), "AB")#