Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public int endTable() {
continue;
}
for (int k = SIZEOF_SHORT; k < len; k += SIZEOF_SHORT) {
if (buf.get(LE_SHORT, vt1 + k) != buf.get(LE_SHORT, vt2 + k)) {
if (buf.get(LE_SHORT, (long) vt1 + k) != buf.get(LE_SHORT, (long) vt2 + k)) {
continue outer;
}
}
Expand All @@ -344,7 +344,7 @@ public int endTable() {
vtables = Arrays.copyOf(vtables, numVtables * 2);
}
vtables[numVtables++] = offset();
buf.set(LE_INT, cap - vtableloc, offset() - vtableloc);
buf.set(LE_INT, (long) cap - vtableloc, offset() - vtableloc);
}
return vtableloc;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private static int align(int pos, int size) {
/// @param fieldOffsets byte offset of each field, parallel to the struct's field list
/// @param size total padded struct size in bytes
/// @param alignment struct alignment (the maximum field alignment)
@SuppressWarnings("java:S6218") // codegen-internal data carrier; fieldOffsets is an array of immutable primitives consumed by the generator and never compared.
public record StructLayout(int[] fieldOffsets, int size, int alignment) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ public interface Progress {

private static Peek peekFlatRoot(MemorySegment seg, List<String> arraySpecs) {
int segLen = (int) seg.byteSize();
int fbLen = seg.get(LE_INT, segLen - 4);
int fbStart = segLen - 4 - fbLen;
int fbLen = seg.get(LE_INT, segLen - 4L);
long fbStart = segLen - 4L - fbLen;
FbsArray fbArray = FbsArray.getRootAsFbsArray(seg.asSlice(fbStart, fbLen));
FbsArrayNode root = fbArray.root();
if (root == null) {
Expand Down
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
**/fbs/**,
**/proto/**
</sonar.exclusions>
<!-- The two in-house code generators (fbs-gen, proto-gen) are build-only developer
tooling, not shipped runtime. Their lexers/parsers share the same tokenizer
shape by design (scan char, classify token, advance), which the duplication
metric counts as cross-module copy-paste. Exclude from CPD only — smell and
bug analysis on this hand-written code is kept. -->
<sonar.cpd.exclusions>
**/fbsgen/**,
**/protogen/**
</sonar.cpd.exclusions>
<!-- Coverage sources:
1. per-module surefire (unit tests)
2. per-module failsafe (module-local integration tests)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Array decode(MemorySegment seg, List<String> encodingSpecs,

// The trailing u32 length field must itself be in range before we read it.
IoBounds.checkRange(segLen - 4L, 4, segLen);
int fbLen = seg.get(LE_INT, segLen - 4);
int fbLen = seg.get(LE_INT, segLen - 4L);
long fbStart = segLen - 4L - fbLen;
IoBounds.checkRange(fbStart, fbLen, segLen);
var fbArray = io.github.dfa1.vortex.fbs.FbsArray.getRootAsFbsArray(seg.asSlice(fbStart, fbLen));
Expand Down
Loading