diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2023-12-10 20:54:33 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2023-12-10 21:05:54 +0100 |
commit | 147a1c19c1f7bfe8d0939618d3c8dc2bb4e59fb7 (patch) | |
tree | 59068e90abb014e29901f7bcf91be2a8b08f79ef /jgvariant-core | |
parent | df853ef46a9c12d319bf824ac106a411f5eddabd (diff) |
Add more property-based tests and fix more bugs.
Change-Id: I8deb1a7d75078c037714541d8f6f656052c2476c
Diffstat (limited to 'jgvariant-core')
-rw-r--r-- | jgvariant-core/src/main/java/eu/mulk/jgvariant/core/Decoder.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/jgvariant-core/src/main/java/eu/mulk/jgvariant/core/Decoder.java b/jgvariant-core/src/main/java/eu/mulk/jgvariant/core/Decoder.java index fcbb639..2121cfb 100644 --- a/jgvariant-core/src/main/java/eu/mulk/jgvariant/core/Decoder.java +++ b/jgvariant-core/src/main/java/eu/mulk/jgvariant/core/Decoder.java @@ -364,7 +364,7 @@ public abstract class Decoder<T> { // Determining the framing offset size requires trial and error. int framingOffsetSize; for (framingOffsetSize = 0;; framingOffsetSize = max(1, framingOffsetSize << 1)) { - if (elementsRelativeEnd + framingOffsetSize* framingOffsets.size() >= 1 << (8*framingOffsetSize)) { + if (elementsRelativeEnd + (long)framingOffsetSize * framingOffsets.size() >= 1L << (8*framingOffsetSize)) { continue; } @@ -457,7 +457,7 @@ public abstract class Decoder<T> { } // Write the framing offsets. - int framingOffsetSize = computeFramingOffsetSize(byteWriter.position() - startOffset, framingOffsets); + int framingOffsetSize = max(1, computeFramingOffsetSize(byteWriter.position() - startOffset, framingOffsets)); for (var framingOffset : framingOffsets) { byteWriter.writeIntN(framingOffset, framingOffsetSize); } |