Skip to content

Potential nullptr dereference in LLVM to SPIR-V Debug info translation #2949

Open
@AlexeySachkov

Description

@AlexeySachkov

In the following code BB can be set to nullptr, but it is unconditionally dereferenced later which could lead to segfaults

SPIRVBasicBlock *BB = F->getNumBasicBlock() ? F->getBasicBlock(0) : nullptr;
SPIRVId ExtSetId = BM->getExtInstSetId(BM->getDebugInfoEIS());
return BM->addExtInst(getVoidTy(), ExtSetId, SPIRVDebug::FunctionDefinition,
Ops, BB, BB->getInst(0));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions