mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-10 11:50:29 +00:00
fix refcount issue after ubsan pointed out error
There was a comment there warning of memory faults. asan/ubsan proved it right.
This commit is contained in:
parent
cf00bd8724
commit
ea2a5ffd6c
1 changed files with 3 additions and 3 deletions
6
third_party/python/Python/import.c
vendored
6
third_party/python/Python/import.c
vendored
|
@ -2289,12 +2289,12 @@ static PyObject *_imp_validate_bytecode_header(PyObject *module, PyObject *args,
|
||||||
data.buf = &(buf[12]);
|
data.buf = &(buf[12]);
|
||||||
data.len -= 12;
|
data.len -= 12;
|
||||||
result = PyMemoryView_FromBuffer(&data);
|
result = PyMemoryView_FromBuffer(&data);
|
||||||
// TODO: figure out if refcounts are managed between data and result
|
// TODO: figure out how refcounts are managed between data and result
|
||||||
|
|
||||||
// if there is a memory fault, use the below line which copies
|
// if there is a memory fault, use the below line which copies
|
||||||
// result = PyBytes_FromStringAndSize(&(buf[12]), data.len-12);
|
// result = PyBytes_FromStringAndSize(&(buf[12]), data.len-12);
|
||||||
exit:
|
exit:
|
||||||
if (data.obj) PyBuffer_Release(&data);
|
if (!result && data.obj) PyBuffer_Release(&data);
|
||||||
|
// if (data.obj) PyBuffer_Release(&data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
PyDoc_STRVAR(_imp_validate_bytecode_header_doc,
|
PyDoc_STRVAR(_imp_validate_bytecode_header_doc,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue