diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-09-16 19:16:48 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-09-16 19:16:48 +0000 |
commit | be409c70b26dc5655f157692f253262df9b7553f (patch) | |
tree | b60e633dde4f7e1cd543c1d67a4a55a5d1570850 /pkg/sentry/vfs | |
parent | e73986dd376c2c71d81ab8ccabdea3aecac5e9d5 (diff) | |
parent | 51b96514cd9397870b39506e3693017a355319dd (diff) |
Merge release-20210906.0-35-g51b96514c (automated)
Diffstat (limited to 'pkg/sentry/vfs')
-rw-r--r-- | pkg/sentry/vfs/file_description_impl_util.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/file_description_impl_util.go b/pkg/sentry/vfs/file_description_impl_util.go index 5dab069ed..452f5f1f9 100644 --- a/pkg/sentry/vfs/file_description_impl_util.go +++ b/pkg/sentry/vfs/file_description_impl_util.go @@ -17,6 +17,7 @@ package vfs import ( "bytes" "io" + "math" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/context" @@ -399,6 +400,9 @@ func (fd *DynamicBytesFileDescriptionImpl) Write(ctx context.Context, src userme // GenericConfigureMMap may be used by most implementations of // FileDescriptionImpl.ConfigureMMap. func GenericConfigureMMap(fd *FileDescription, m memmap.Mappable, opts *memmap.MMapOpts) error { + if opts.Offset+opts.Length > math.MaxInt64 { + return linuxerr.EOVERFLOW + } opts.Mappable = m opts.MappingIdentity = fd fd.IncRef() |