Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport: Fix for EOFException on NCDump data #538

Merged
merged 2 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,8 @@ class GlobalHeap {
long startPos = raf.getFilePointer();
GlobalHeap.HeapObject o = new GlobalHeap.HeapObject();
o.id = raf.readShort();
if (o.id == 0)
break; // ?? look
o.refCount = raf.readShort();
raf.skipBytes(4);
o.dataSize = header.readLength();
Expand All @@ -2634,8 +2636,6 @@ class GlobalHeap {
int dsize = ((int) o.dataSize) + padding((int) o.dataSize, 8);
countBytes += dsize + 16;

if (o.id == 0)
break; // ?? look
if (o.dataSize < 0)
break; // ran off the end, must be done
if (countBytes < 0)
Expand Down
4 changes: 2 additions & 2 deletions cdm/core/src/main/java/ucar/nc2/iosp/hdf5/H5header.java
Original file line number Diff line number Diff line change
Expand Up @@ -4900,6 +4900,8 @@ private class GlobalHeap {
long startPos = raf.getFilePointer();
HeapObject o = new HeapObject();
o.id = raf.readShort();
if (o.id == 0)
break; // ?? look
o.refCount = raf.readShort();
raf.skipBytes(4);
o.dataSize = readLength();
Expand All @@ -4908,8 +4910,6 @@ private class GlobalHeap {
int dsize = ((int) o.dataSize) + padding((int) o.dataSize, 8);
countBytes += dsize + 16;

if (o.id == 0)
break; // ?? look
if (o.dataSize < 0)
break; // ran off the end, must be done
if (countBytes < 0)
Expand Down