boostorg / boostorg/python

NULL ptr deref in instance_dealloc

Open
#421 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
537
Forks
223
Avg merge
11h 22m
Merged PRs (30d)
2

Description

Hi, we've recently triggered null pointer deref in [that place](https://github.com/boostorg/python/blob/47d5bc76f69e20625214381c930a2fad5765e2b3/src/object/class.cpp#L337C49-L337C71), right on dynamic_cast. From the first glance code does not look correct, dynamic_cast occurs after explicitly calling destructor on object. In our combination of clang16, gcc13 and python3.11 (I don't know what exactly triggered this) this destructor compiles in such way that vtable pointer is set to 0 in the end, which does not work so well with dynamic_cast.

Using object after destroying it sound like UB anyway, can it be fixed somehow? Using dynamic_cast before calling object destructor?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.