This is an archive of the discontinued LLVM Phabricator instance.

[SourceManager] Explicitly check for potential iterator underflow
ClosedPublic

Authored by jkorous on Aug 19 2020, 10:08 AM.

Diff Detail

Event Timeline

jkorous created this revision.Aug 19 2020, 10:08 AM
jkorous requested review of this revision.Aug 19 2020, 10:08 AM
arphaman added a comment.EditedSep 2 2020, 1:46 PM

Do you have a test case? Please add a comment stating why the check is needed.

Unfortunately, I don't have a test, sorry. I'm not trying to cut corners here - just thought that iterator referring to begin() value of a container should never be decremented so given the nature of the issue, simplicity of the fix and expected effort necessary to find a reliable test case it'd be more productive if I spend my time doing other work.

But please tell me if you think this is not an obvious bug and an obvious way to fix it - I could be missing something.

jkorous updated this revision to Diff 289758.Sep 3 2020, 10:30 AM

Add comment

arphaman accepted this revision.Sep 15 2020, 1:40 PM
This revision is now accepted and ready to land.Sep 15 2020, 1:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2020, 3:54 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript