This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] move a pointer dereference after its null check
ClosedPublic

Authored by yingcong-wu on Apr 22 2023, 11:16 PM.

Details

Summary

The dereference of pointer ctx is not protected by its null check, this could be problematic.

Diff Detail

Event Timeline

yingcong-wu created this revision.Apr 22 2023, 11:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2023, 11:16 PM
Herald added a subscriber: Enna1. · View Herald Transcript
yingcong-wu requested review of this revision.Apr 22 2023, 11:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2023, 11:16 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Apr 25 2023, 7:41 PM
This revision is now accepted and ready to land.Apr 25 2023, 7:41 PM
MaskRay accepted this revision.Apr 26 2023, 6:51 PM
MaskRay added a subscriber: MaskRay.

Nit

compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
1376–1377

if (res >= 0 && ctx) to avoid nesting.

  • avoid nesting
yingcong-wu marked an inline comment as done.Apr 26 2023, 6:55 PM
This revision was landed with ongoing or failed builds.Apr 26 2023, 6:59 PM
This revision was automatically updated to reflect the committed changes.