Skip to content

Potential null pointer dereference in PythonQtConvertListOfKnownClassToPythonList #60

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

Closed
samoptibrium opened this issue Nov 2, 2021 · 1 comment · Fixed by #173
Closed
Labels
bug Something isn't working

Comments

@samoptibrium
Copy link

samoptibrium commented Nov 2, 2021

static PythonQtClassInfo* innerType = PythonQt::priv()->getClassInfo(PythonQtMethodInfo::getInnerListTypeName(QByteArray(QMetaType::typeName(metaTypeId))));
if (innerType == NULL) {
std::cerr << "PythonQtConvertListOfKnownClassToPythonList: unknown inner type " << innerType->className().constData() << std::endl;
}

static PythonQtClassInfo* innerType = PythonQt::priv()->getClassInfo(PythonQtMethodInfo::getInnerListTypeName(QByteArray(QMetaType::typeName(metaTypeId))));
if (innerType == NULL) {
std::cerr << "PythonQtConvertListOfKnownClassToPythonList: unknown inner type " << innerType->className().constData() << std::endl;
}

This code checks the "innerType" pointer for null and then, if null, is dereferencing the pointer in the cerr prints.

@usiems
Copy link
Contributor

usiems commented Nov 2, 2021

Indeed, QMetaType::typeName(metaTypeId) should be used instead of innerType->className().constData(), like in the methods above.
I guess this never was a problem because these methods really are only used with known classes.

@mrbean-bremen mrbean-bremen added the bug Something isn't working label Nov 9, 2023
mrbean-bremen added a commit to mrbean-bremen/pythonqt that referenced this issue Dec 15, 2023
mrbean-bremen added a commit to mrbean-bremen/pythonqt that referenced this issue Dec 15, 2023
mrbean-bremen added a commit that referenced this issue Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants