Fix out of bounds write on platforms where sizeof(bool) != 1
Found by code scanning
This commit is contained in:
parent
209b78a3ec
commit
dad7d366b3
@ -123,7 +123,7 @@ new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
) {
|
||||
Py_CLEAR(self); return NULL;
|
||||
}
|
||||
self->alt_tabstops = self->main_tabstops + self->columns * sizeof(bool);
|
||||
self->alt_tabstops = self->main_tabstops + self->columns;
|
||||
self->tabstops = self->main_tabstops;
|
||||
init_tabstops(self->main_tabstops, self->columns);
|
||||
init_tabstops(self->alt_tabstops, self->columns);
|
||||
@ -236,7 +236,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
|
||||
PyMem_Free(self->main_tabstops);
|
||||
self->main_tabstops = PyMem_Calloc(2*self->columns, sizeof(bool));
|
||||
if (self->main_tabstops == NULL) { PyErr_NoMemory(); return false; }
|
||||
self->alt_tabstops = self->main_tabstops + self->columns * sizeof(bool);
|
||||
self->alt_tabstops = self->main_tabstops + self->columns;
|
||||
self->tabstops = self->main_tabstops;
|
||||
init_tabstops(self->main_tabstops, self->columns);
|
||||
init_tabstops(self->alt_tabstops, self->columns);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user