davidmalcolm / gcc-python-plugin

GCC plugin that embeds CPython inside the compiler
GNU General Public License v3.0
199 stars 58 forks source link

False positive with PyTuple_SetItem() where index can't be out of range #76

Open davidmalcolm opened 7 years ago

davidmalcolm commented 7 years ago

See e.g.: http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-03-05/pygoocanvas-0.14.1-6.fc17/pygoocanvas-0.14.1/.libs/goocanvas.c._wrap_goo_canvas_item_model_get_child_properties-refcount-errors.html#report-0

The checker considered that the possibility of PyTuple_SetItem() failing due to index out of range (and thus not stealing the reference, leading to a leak), but it's provable that the index is within range (and is of the correct type), thus the call can't fail.

davidmalcolm commented 7 years ago

Imported from trac issue 36. Created by dmalcolm on 2012-03-05T13:54:34, last modified: 2012-03-05T17:11:15

davidmalcolm commented 7 years ago

Trac comment by dmalcolm on 2012-03-05 17:11:15:

The same issue seen with this false-positive: http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-03-05/python-virtkey-0.50-11.fc17/python-virtkey-0.50/build/temp.linux-x86_64-2.7/python-virtkey.c.virtkey_layout_get_sections-refcount-errors.html#report-0