mirror of
https://github.com/corda/corda.git
synced 2025-02-07 19:40:25 +00:00
fix broken field alignment in parseFieldTable which caused longs to overlap other fields on 32-bit systems in certain cases
This commit is contained in:
parent
91494d9081
commit
907382bcee
@ -861,7 +861,7 @@ parseFieldTable(Thread* t, Stream& s, object class_, object pool)
|
||||
|
||||
if (flags & ACC_STATIC) {
|
||||
unsigned size = fieldSize(t, code);
|
||||
unsigned excess = staticOffset % size;
|
||||
unsigned excess = (staticOffset % size) % BytesPerWord;
|
||||
if (excess) {
|
||||
staticOffset += BytesPerWord - excess;
|
||||
}
|
||||
@ -878,7 +878,7 @@ parseFieldTable(Thread* t, Stream& s, object class_, object pool)
|
||||
abort(t); // todo: handle non-static field initializers
|
||||
}
|
||||
|
||||
unsigned excess = memberOffset % fieldSize(t, code);
|
||||
unsigned excess = (memberOffset % fieldSize(t, code)) % BytesPerWord;
|
||||
if (excess) {
|
||||
memberOffset += BytesPerWord - excess;
|
||||
}
|
||||
|
@ -2,7 +2,22 @@ public class Misc {
|
||||
private static int alpha;
|
||||
private static int beta;
|
||||
private static byte byte1, byte2, byte3;
|
||||
|
||||
private int gamma;
|
||||
private int pajama;
|
||||
private boolean boolean1;
|
||||
private boolean boolean2;
|
||||
private long time;
|
||||
|
||||
public Misc() {
|
||||
expect(! boolean1);
|
||||
expect(! boolean2);
|
||||
|
||||
time = 0xffffffffffffffffL;
|
||||
|
||||
expect(! boolean1);
|
||||
expect(! boolean2);
|
||||
}
|
||||
|
||||
private String foo(String s) {
|
||||
return s;
|
||||
|
Loading…
x
Reference in New Issue
Block a user