mirror of
https://github.com/reactos/syzkaller-ros.git
synced 2025-03-03 08:57:06 +00:00
pkg/compiler: fix alignment calculation bug
This commit is contained in:
parent
1c0d4caf7c
commit
a29e1be6ff
@ -276,9 +276,7 @@ func (comp *compiler) addAlignment(fields []sys.Type, varlen, packed bool, align
|
||||
}
|
||||
return newFields
|
||||
}
|
||||
var off uint64
|
||||
// TODO(dvyukov): this is wrong: if alignAttr!=0, we must use it, not max
|
||||
align := alignAttr
|
||||
var align, off uint64
|
||||
for i, f := range fields {
|
||||
if i > 0 && !fields[i-1].BitfieldMiddle() {
|
||||
a := comp.typeAlign(f)
|
||||
@ -300,6 +298,9 @@ func (comp *compiler) addAlignment(fields []sys.Type, varlen, packed bool, align
|
||||
off += f.Size()
|
||||
}
|
||||
}
|
||||
if alignAttr != 0 {
|
||||
align = alignAttr
|
||||
}
|
||||
if align != 0 && off%align != 0 && !varlen {
|
||||
pad := align - off%align
|
||||
off += pad
|
||||
|
Loading…
x
Reference in New Issue
Block a user