8319882: SequenceLayout::toString throws ArithmeticException

Reviewed-by: mcimadamore
This commit is contained in:
Per Minborg 2023-11-10 14:24:22 +00:00
parent 6b21ff61da
commit c9657cad12
2 changed files with 16 additions and 1 deletions

View file

@ -179,7 +179,7 @@ public final class SequenceLayoutImpl extends AbstractLayout<SequenceLayoutImpl>
@Override
public String toString() {
boolean max = (Long.MAX_VALUE / elementLayout.byteSize()) == elemCount;
boolean max = (Long.MAX_VALUE / Math.max(1, elementLayout.byteSize())) == elemCount;
return decorateLayoutString(String.format("[%s:%s]",
max ? "*" : elemCount, elementLayout));
}