[llvm] [Object][DirectX] Fix UB when parsing a DXContainer from a null buffer (PR #200865)
Vladislav Dzhidzhoev via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 10:55:38 PDT 2026
dzhidzhoev wrote:
> In any case, this change is correct, so if we do anything else it can be in a follow up. LGTM.
By the way, `Src < Buffer.begin()` is unspecified behavior, as well as `Src > Buffer.end()`. I think it will be safer to replace these subconditions with `Size > Buffer.end() - Src`.
> I wonder if it would be worth refactoring this a bit so that the substring is represented as a StringRef throughout so that we don't have to take into account that StringRef's data() can be either null or an empty string for a size 0 string.
I will try that.
https://github.com/llvm/llvm-project/pull/200865
More information about the llvm-commits
mailing list