[New-bugs-announce] [issue13148] simple bug in mmap size check
Maxim Yanchenko
report at bugs.python.org
Tue Oct 11 02:45:48 CEST 2011
New submission from Maxim Yanchenko <maxim.yanchenko at gs.com>:
The condition contradicts the exception text:
if (offset >= st.st_size) {
PyErr_SetString(PyExc_ValueError,
"mmap offset is greater than file size");
return NULL;
}
The condition should be changed to (offset > st.st_size), similar to the later condition which is correct:
} else if (offset + (size_t)map_size > st.st_size) {
PyErr_SetString(PyExc_ValueError,
"mmap length is greater than file size");
return NULL;
}
The patch is attached.
----------
components: Library (Lib)
files: mmap-greater.patch
keywords: patch
messages: 145319
nosy: jazzer
priority: normal
severity: normal
status: open
title: simple bug in mmap size check
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file23372/mmap-greater.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13148>
_______________________________________
More information about the New-bugs-announce
mailing list