Page MenuHomePhabricator

[analyzer] NFC: RetainCount: Don't dump() regions to the user.
ClosedPublic

Authored by NoQ on Jan 12 2018, 3:45 PM.

Details

Summary

RetainCountChecker appears to be using MemRegion::getString() to present the region to the user, which is equivalent to MemRegion->dump() and as such may produce human-unreadable dumps.

Fortunately, for now RetainCountChecker only tracks pointer bindings through local variables, and treats all other bindings as pointer escapes. For local variables, this worked well.

Before r315736/D38877, however, it used to be possible to modify retain count of a pointer "in place" after writing it anywhere, eg.:

anyWeirdLocation = x;
SafeCFRetain(anyWeirdLocation);

...which not only caused a leak false positive, but also triggered a dump of anyWeirdLocation (which may be literally any weird location) into the checker's warning message.

So for now i'm not seeing any other cases where this leaks, but i still want to add an assertion to make sure this never happens again.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ created this revision.Jan 12 2018, 3:45 PM
dcoughlin accepted this revision.Jan 12 2018, 5:52 PM

LGTM. Thanks for fixing this.

This revision is now accepted and ready to land.Jan 12 2018, 5:52 PM
This revision was automatically updated to reflect the committed changes.