Skip to content
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

[SYCL][ClangLinkerWrapper] Fix read of invalid memory #15472

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1471,8 +1471,12 @@ Error extractBundledObjects(StringRef Filename, const ArgList &Args,
llvm::MemoryBuffer::getFileOrSTDIN(*UnbundledFile, /*isText=*/true);
if (std::error_code EC = ObjList.getError())
return createFileError(*UnbundledFile, EC);
(*ObjList)->getBuffer().split(ObjectFilePaths, '\n', /*MaxSplit=*/-1,
/*KeepEmpty=*/false);
// Create a copy of the list we can reference even after we close
// the file.
StringRef UnbundledArchiveList =
Args.MakeArgString((*ObjList)->getBuffer());
UnbundledArchiveList.split(ObjectFilePaths, '\n', /*MaxSplit=*/-1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where will this variable be used? Not a blocking question.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. It's used here, we immediately split it into the ObjectFilePaths vector .

Copy link
Contributor

@asudarsa asudarsa Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah..of course..I was naive and was looking for this variable on the RHS of an assignment statement. :-(. Thinking more, may be not so naive. I was just wondering where else we would be using UnbundledArchiveList that we needed to store it.

/*KeepEmpty=*/false);
} else {
ObjectFilePaths.push_back(*UnbundledFile);
}
Expand Down
Loading