ac-pm / Inspeckage

Android Package Inspector - dynamic analysis with api hooks, start unexported activities and more. (Xposed Module)
Apache License 2.0
2.81k stars 515 forks source link

Gson UserHook Args/Result serialization causes OutOfMemoryError #45

Open 0x4d4e opened 7 years ago

0x4d4e commented 7 years ago

UserHooks parseParams causes an OutOfMemoryError when serializing a non-trivial, nested Object to JSON.

UserHooks#parseParam

I observed the issue when playing around with Inspeckage and DIVA. In DIVA, many methods are passed a View or another class that contains multiple references to other objects.

I did not find a trivial way to limit Gson parsing of nested objects (especially if it should support arbitrary objects, and not objects that are defined with Gson de/serialization in mind). In my tests, simply using toString() instead of gson.toJson() avoided the problem at the cost of the output format's "beauty".

ac-pm commented 7 years ago

I will look that.