Skip to content

OutOfMemoryError and NegativeArraySizeException in DiskBasedCache.streamToBytes #12

@joebowbeer

Description

@joebowbeer

DiskBasedCache may fail repeatedly if a cached header is corrupt. In the event of failure, the most common error is OutOfMemoryError thrown from streamToBytes, caused by trying to allocate a huge number of bytes resulting from the bogus length calculated due to the corruption.

Once a header has been corrupt, the cache initialization will continue to fail, and the errant header will not be removed.

A less common failure was NegativeArraySizeException, but that was recently patched.

DiscBasedCache needs to be updated to guard against corruption.

Related to:

https://code.google.com/p/android/issues/detail?id=230219
mcxiaoke/android-volley#141 (mirror)
http://stackoverflow.com/a/42196956/901597

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions