Skip to content

Commit

Permalink
#829 Wrap allocation errors in KryoException when reading and writi…
Browse files Browse the repository at this point in the history
…ng fields
  • Loading branch information
theigl committed May 26, 2021
1 parent 3bf0a0a commit 1d72a60
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void write (Kryo kryo, Output output, T object) {
fields[i].write(output, object);
} catch (KryoException e) {
throw e;
} catch (Exception e) {
} catch (OutOfMemoryError | Exception e) {
throw new KryoException("Error writing " + fields[i] + " at position " + output.position(), e);
}
}
Expand All @@ -128,8 +128,8 @@ public T read (Kryo kryo, Input input, Class<? extends T> type) {
try {
fields[i].read(input, object);
} catch (KryoException e) {
throw e;
} catch (Exception e) {
throw e;
} catch (OutOfMemoryError | Exception e) {
throw new KryoException("Error reading " + fields[i] + " at position " + input.position(), e);
}
}
Expand Down

1 comment on commit 1d72a60

@robert-gdv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like fixing a symptom, not the problem.
If you are running OutOfMemory, you probably also don't have the memory to create a new KryoException or the String for the Exception message. You shouldn't catch Errors.

Just guessing: Maybe the issues are the fuzzer settings to not accept Errors?
Or the fuzzer found a condition which was able to trigger OutOfMemory condition (e.g. due to endless recursion)?

Please sign in to comment.