square / leakcanary

A memory leak detection library for Android.
https://square.github.io/leakcanary
Apache License 2.0
29.42k stars 3.97k forks source link

Heap dump obfuscation should not use 0 / special whitespace. #2323

Closed pyricau closed 2 years ago

pyricau commented 2 years ago

This is from a bugsnag report:

├─ java.util.LinkedHashMap instance
│    Leaking: UNKNOWN
│    Retaining 627 B in 14 objects
│    ↓ LinkedHashMap[""]
│                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ mortar.bundler.BundleServiceRunner instance

Clearly, the content got eaten. Let's replace these with a character like x.

rjrjr commented 2 years ago

Hiding the length would be a good idea. Like, always print XXXX for an ellided span, rather than replacing every ellided character with X.

pyricau commented 2 years ago

note: we already replace char arrays with ?? so I suspect the main issue here is with byte arrays (which are used in some impls of String)