Skip to content

"Opening snapshot failed." due to incomplete compressed data read #257

Description

@Player3324

Describe the bug
Opening some nps files containing CPU sampling snapshot data will fail with an "Opening snapshot failed." error dialog.

The way

and surrounding code was implemented doesn't guarantee that the entire compressedDataLen bytes were read from dis.

If the alignment between the involved buffer and net data sizes happens to lie within the tailing zlib checksum bytes, this checksum won't ever be fully read or checked. The following settingsLen read will then start too early, including the last part of the zlib checksum in its value and thus corrupting itself and any remaining reads.

This should be easy to fix by doing another dataDis.read() after the above quoted line, which would then return -1 (EOF) and make sure the entire compressed data was pulled in.

To Reproduce
Unzip and try to load visualvm-bug.zip

Expected behavior
The nps file gets loaded without an error

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions