homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Uninitialised variable in _PyObject_GenericSetAttrWithDict
Type: compile error Stage:
Components: Installation Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Jim.Jewett, Mark.Shannon, benjamin.peterson
Priority: normal Keywords: patch

Created on 2012年03月09日 10:04 by Mark.Shannon, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
uninitialised_descr.patch Mark.Shannon, 2012年03月09日 10:04 review
Messages (3)
msg155221 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2012年03月09日 10:04
I get the following compiler warning (rev 2a142141e5fd)
Its not strictly an error, but an unitialised variable in such an 
important function is dangerous.
Objects/object.c: In function ‘_PyObject_GenericSetAttrWithDict’:
Objects/object.c:1144: warning: ‘descr’ may be used uninitialised in this function
Patch attached
msg155257 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012年03月09日 19:15
Fixed in differently in 46e600fa8d05 Thanks anyway.
msg155259 - (view) Author: Jim Jewett (Jim.Jewett) * (Python triager) Date: 2012年03月09日 19:23
So the risk is that descr may be given garbage memory that just happens to look like an object with 1 reference, so that it really does a decref and tries to re-deallocate whatever was there before.
I would rather see the change at the top of the function; just initialize descr to NULL when it is declared, and let the compiler figure out that it can skip the zeroing on some (most) paths.
History
Date User Action Args
2022年04月11日 14:57:27adminsetgithub: 58447
2012年03月09日 19:23:13Jim.Jewettsetnosy: + Jim.Jewett
messages: + msg155259
2012年03月09日 19:15:50benjamin.petersonsetstatus: open -> closed
resolution: out of date
messages: + msg155257
2012年03月09日 17:18:56pitrousetnosy: + benjamin.peterson
2012年03月09日 10:04:22Mark.Shannoncreate

AltStyle によって変換されたページ (->オリジナル) /