Skip to content

Commit e85a959

Browse files
AlexeySotkinvladimirlaz
authored andcommitted
Fix potential null pointer dereference
Signed-off-by: Alexey Sotkin <[email protected]>
1 parent 3c3fdf1 commit e85a959

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm-spirv/lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,12 @@ void LLVMToSPIRVDbgTran::transLocationInfo() {
201201
SPIRVString *DirAndFile = BM->getString(getFullPath(DL.get()));
202202
if (File != DirAndFile || LineNo != DL.getLine() ||
203203
Col != DL.getCol()) {
204+
V = SPIRVWriter->getTranslatedValue(&I);
205+
if (!V)
206+
continue;
204207
File = DirAndFile;
205208
LineNo = DL.getLine();
206209
Col = DL.getCol();
207-
V = SPIRVWriter->getTranslatedValue(&I);
208210
// According to the spec, OpLine for an OpBranch/OpBranchConditional
209211
// must precede the merge instruction and not the branch instruction
210212
auto *VPrev = static_cast<SPIRVInstruction *>(V)->getPrevious();

0 commit comments

Comments
 (0)