msg240015 - (view) |
Author: Bill Parker (dogbert2) * |
Date: 2015-04-03 17:43 |
Hello All, In reviewing code in directory Python-3.4.3/Modules, file 'mmapmodule', I found a call to 'lseek()' without a check for a return value of -1, indicating failure. The patch file below corrects this issue (diff -u format): --- mmapmodule.c.orig 2015-04-02 19:05:30.380554538 -0700 +++ mmapmodule.c 2015-04-02 19:11:00.320488207 -0700 @@ -1335,7 +1335,11 @@ return NULL; } /* Win9x appears to need us seeked to zero */ - lseek(fileno, 0, SEEK_SET); + if (lseek(fileno, 0, SEEK_SET) == -1) { /* call to lseek() failed */ + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } + } m_obj = (mmap_object *)type->tp_alloc(type, 0); I am attaching the patch file to this bug report... |
|
|
msg240051 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2015-04-04 08:32 |
Thanks for the patch, Bill. If you want to work on similar issues see also issue 15948. |
|
|
msg240088 - (view) |
Author: Bill Parker (dogbert2) * |
Date: 2015-04-04 20:07 |
I would check 23855 as well, since the malloc() missing a sanity check, which could be a more serious issue .. On Sat, Apr 4, 2015 at 1:32 AM, Berker Peksag <report@bugs.python.org> wrote: > > Berker Peksag added the comment: > > Thanks for the patch, Bill. If you want to work on similar issues see also > issue 15948. > > ---------- > components: +Extension Modules -Interpreter Core > nosy: +berker.peksag, haypo, serhiy.storchaka > stage: -> patch review > versions: +Python 3.5 > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue23860> > _______________________________________ > |
|
|
msg240383 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2015-04-09 20:35 |
> /* Win9x appears to need us seeked to zero */ > lseek(fileno, 0, SEEK_SET); Hum, is it still needed in 2015 with Python 3.5? We even dropped support for Windows XP. |
|
|
msg240384 - (view) |
Author: Bill Parker (dogbert2) * |
Date: 2015-04-09 20:37 |
At the moment, I'm not sure if it's needed or not, but if it's only an issue with XP, then it might not be worth fixing...:) On Thu, Apr 9, 2015 at 1:35 PM, STINNER Victor <report@bugs.python.org> wrote: > > STINNER Victor added the comment: > > > /* Win9x appears to need us seeked to zero */ > > lseek(fileno, 0, SEEK_SET); > > Hum, is it still needed in 2015 with Python 3.5? We even dropped support > for Windows XP. > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue23860> > _______________________________________ > |
|
|
msg317284 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2018-05-22 13:45 |
"At the moment, I'm not sure if it's needed or not, but if it's only an issue with XP, then it might not be worth fixing...:)" If the workaround is no longer needed, the lseek() call should be removed. |
|
|
msg317285 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2018-05-22 13:47 |
Oh right, PR 7017 does that: it removes the lseek() call ;-) |
|
|