proost commented on code in PR #789:
URL: https://github.com/apache/datasketches-java/pull/789#discussion_r4444232422
##########
src/main/java/org/apache/datasketches/tuple/arrayofdoubles/HeapArrayOfDoublesCompactSketch.java:
##########
@@ -126,8 +126,9 @@ final class HeapArrayOfDoublesCompactSketch extends
ArrayOfDoublesCompactSketch
throw new SketchesArgumentException(
"Serial version mismatch. Expected: " + serialVersionUID + ",
actual: " + version);
}
- Util.checkSeedHashes(seedHash_, Util.computeSeedHash(seed));
isEmpty_ = (seg.get(JAVA_BYTE, FLAGS_BYTE) & (1 <<
Flags.IS_EMPTY.ordinal())) != 0;
+ // the seed hash of an empty image is ignored; historical images may have
filled it in
+ if (!isEmpty_) { Util.checkSeedHashes(seedHash_,
Util.computeSeedHash(seed)); }
Review Comment:
To protect from corrupted input, can you change to `(!isEmpty_ |
hasEntries)`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]