Fix array allocation.

This commit is contained in:
Andy Nguyen 2024-12-06 12:54:12 +01:00
parent f3a31c611e
commit 84dfba6fd9
5 changed files with 11 additions and 19 deletions

View File

@ -9,7 +9,7 @@ package com.bdjb.api;
public final class Int16Array extends Buffer {
public Int16Array(int length) {
super(Int16.SIZE);
super(length * Int16.SIZE);
}
public short get(int index) {

View File

@ -9,7 +9,7 @@ package com.bdjb.api;
public final class Int32Array extends Buffer {
public Int32Array(int length) {
super(Int32.SIZE);
super(length * Int32.SIZE);
}
public int get(int index) {

View File

@ -9,7 +9,7 @@ package com.bdjb.api;
public final class Int64Array extends Buffer {
public Int64Array(int length) {
super(Int64.SIZE);
super(length * Int64.SIZE);
}
public long get(int index) {

View File

@ -9,7 +9,7 @@ package com.bdjb.api;
public final class Int8Array extends Buffer {
public Int8Array(int length) {
super(Int8.SIZE);
super(length * Int8.SIZE);
}
public byte get(int index) {

View File

@ -42,6 +42,9 @@ public class KernelAPI {
private long kaslrOffset;
private Int32Array masterPipeFd = new Int32Array(2);
private Int32Array victimPipeFd = new Int32Array(2);
private int masterRpipeFd;
private int masterWpipeFd;
private int victimRpipeFd;
@ -79,9 +82,6 @@ public class KernelAPI {
}
private void initPipes() {
Int32Array masterPipeFd = new Int32Array(2);
Int32Array victimPipeFd = new Int32Array(2);
pipe(masterPipeFd);
pipe(victimPipeFd);
@ -179,20 +179,12 @@ public class KernelAPI {
kwrite(addr, tmp, Int64.SIZE);
}
public int getMasterRpipeFd() {
return masterRpipeFd;
public Int32Array getMasterPipeFd() {
return masterPipeFd;
}
public int getMasterWpipeFd() {
return masterWpipeFd;
}
public int getVictimRpipeFd() {
return victimRpipeFd;
}
public int getVictimWpipeFd() {
return victimWpipeFd;
public Int32Array getVictimPipeFd() {
return victimPipeFd;
}
public long getKaslrOffset() {