mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
#15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete
This commit is contained in:
parent
3159cb51a7
commit
1f2799bef4
2 changed files with 10 additions and 5 deletions
|
@ -1342,6 +1342,11 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
|
|||
}
|
||||
|
||||
size = (((PY_LONG_LONG) high) << 32) + low;
|
||||
if (size == 0) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"cannot mmap an empty file");
|
||||
return NULL;
|
||||
}
|
||||
if (offset >= size) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"mmap offset is greater than file size");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue