-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix missing null dereference checks #9489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -941,6 +941,10 @@ font_render(FontObject *self, PyObject *args) { | |||||||
| return NULL; | ||||||||
| } | ||||||||
| PyObject *imagePtr = PyObject_GetAttrString(image, "ptr"); | ||||||||
| if (!imagePtr) { | ||||||||
| PyMem_Del(glyph_info); | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| return NULL; | ||||||||
| } | ||||||||
| im = (Imaging)PyCapsule_GetPointer(imagePtr, IMAGING_MAGIC); | ||||||||
| Py_XDECREF(imagePtr); | ||||||||
|
|
||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -143,6 +143,9 @@ match(PyObject *self, PyObject *args) { | |||||
| } | ||||||
|
|
||||||
| imgin = (Imaging)PyCapsule_GetPointer(i0, IMAGING_MAGIC); | ||||||
| if (!imgin) { | ||||||
| return NULL; | ||||||
| } | ||||||
|
|
||||||
| if (imgin->type != IMAGING_TYPE_UINT8 || imgin->bands != 1) { | ||||||
| PyErr_SetString(PyExc_RuntimeError, "Unsupported image type"); | ||||||
|
|
@@ -185,6 +188,10 @@ match(PyObject *self, PyObject *args) { | |||||
| (b6 << 6) | (b7 << 7) | (b8 << 8)); | ||||||
| if (lut[lut_idx]) { | ||||||
| PyObject *coordObj = Py_BuildValue("(nn)", col_idx, row_idx); | ||||||
| if (!coordObj) { | ||||||
| Py_XDECREF(ret); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| return NULL; | ||||||
| } | ||||||
| PyList_Append(ret, coordObj); | ||||||
| Py_XDECREF(coordObj); | ||||||
| } | ||||||
|
|
@@ -230,6 +237,10 @@ get_on_pixels(PyObject *self, PyObject *args) { | |||||
| for (col_idx = 0; col_idx < width; col_idx++) { | ||||||
| if (row[col_idx]) { | ||||||
| PyObject *coordObj = Py_BuildValue("(nn)", col_idx, row_idx); | ||||||
| if (!coordObj) { | ||||||
| Py_XDECREF(ret); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| return NULL; | ||||||
| } | ||||||
| PyList_Append(ret, coordObj); | ||||||
| Py_XDECREF(coordObj); | ||||||
| } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to leave a GitHub comment explaining the uncertainty around this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it should be there, but I wasn’t sure and it was late.