This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] check pointer before dereference
ClosedPublic

Authored by BeMg on May 30 2023, 8:14 AM.

Details

Summary

Encountered ASAN crash and found it dereference without check pointer.

Diff Detail

Event Timeline

BeMg created this revision.May 30 2023, 8:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2023, 8:14 AM
BeMg requested review of this revision.May 30 2023, 8:14 AM
llvm/lib/Support/RISCVISAInfo.cpp
705

What about:

auto GoToNextExt = [&](StringRef::iterator &I, unsigned ConsumeLength) {
  I += 1 + ConsumeLength;
  if (I != Exts.end() && *I == '_')
    ++I;
};

So that there is no need to make changes below.

kito-cheng accepted this revision.May 31 2023, 1:58 AM

LGTM, I guess I am old school guys, I would like to explicitly pass values instead of capture ref. from outside.

This revision is now accepted and ready to land.May 31 2023, 1:58 AM
eklepilkina accepted this revision.May 31 2023, 3:40 AM
This revision was automatically updated to reflect the committed changes.