From 529a3daa6fa3f3f4af6c2bcaf7e84c61a0a08843 Mon Sep 17 00:00:00 2001 From: Martin Dindoffer Date: Fri, 6 May 2022 15:01:12 +0200 Subject: [PATCH] Fix integer overflow in setListPointer size calculation --- runtime/src/main/java/org/capnproto/WireHelpers.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/main/java/org/capnproto/WireHelpers.java b/runtime/src/main/java/org/capnproto/WireHelpers.java index 8d85160..9327386 100644 --- a/runtime/src/main/java/org/capnproto/WireHelpers.java +++ b/runtime/src/main/java/org/capnproto/WireHelpers.java @@ -1035,7 +1035,7 @@ final class WireHelpers { }; static SegmentBuilder setListPointer(SegmentBuilder segment, CapTableBuilder capTable, int refOffset, ListReader value) { - int totalSize = roundBitsUpToWords(value.elementCount * value.step); + int totalSize = roundBitsUpToWords((long) value.elementCount * value.step); if (value.step <= Constants.BITS_PER_WORD) { //# List of non-structs.