mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
splice: return EINVAL is len is negative
Reported-by: syzbot+0268cc591c0f517a1de0@syzkaller.appspotmail.com PiperOrigin-RevId: 337901664
This commit is contained in:
@@ -45,6 +45,9 @@ func Splice(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscal
|
||||
if count > int64(kernel.MAX_RW_COUNT) {
|
||||
count = int64(kernel.MAX_RW_COUNT)
|
||||
}
|
||||
if count < 0 {
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
// Check for invalid flags.
|
||||
if flags&^(linux.SPLICE_F_MOVE|linux.SPLICE_F_NONBLOCK|linux.SPLICE_F_MORE|linux.SPLICE_F_GIFT) != 0 {
|
||||
@@ -192,6 +195,9 @@ func Tee(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallCo
|
||||
if count > int64(kernel.MAX_RW_COUNT) {
|
||||
count = int64(kernel.MAX_RW_COUNT)
|
||||
}
|
||||
if count < 0 {
|
||||
return 0, nil, syserror.EINVAL
|
||||
}
|
||||
|
||||
// Check for invalid flags.
|
||||
if flags&^(linux.SPLICE_F_MOVE|linux.SPLICE_F_NONBLOCK|linux.SPLICE_F_MORE|linux.SPLICE_F_GIFT) != 0 {
|
||||
|
||||
Reference in New Issue
Block a user