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/fs/fsutil/file.go | |
parent | e73986dd376c2c71d81ab8ccabdea3aecac5e9d5 (diff) | |
parent | 51b96514cd9397870b39506e3693017a355319dd (diff) |
Merge release-20210906.0-35-g51b96514c (automated)
Diffstat (limited to 'pkg/sentry/fs/fsutil/file.go')
-rw-r--r-- | pkg/sentry/fs/fsutil/file.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/fs/fsutil/file.go b/pkg/sentry/fs/fsutil/file.go index 3ece73b81..38e3ed42d 100644 --- a/pkg/sentry/fs/fsutil/file.go +++ b/pkg/sentry/fs/fsutil/file.go @@ -16,6 +16,7 @@ package fsutil import ( "io" + "math" "gvisor.dev/gvisor/pkg/context" "gvisor.dev/gvisor/pkg/errors/linuxerr" @@ -210,6 +211,9 @@ func (FileNoMMap) ConfigureMMap(context.Context, *fs.File, *memmap.MMapOpts) err // GenericConfigureMMap implements fs.FileOperations.ConfigureMMap for most // filesystems that support memory mapping. func GenericConfigureMMap(file *fs.File, m memmap.Mappable, opts *memmap.MMapOpts) error { + if opts.Offset+opts.Length > math.MaxInt64 { + return linuxerr.EOVERFLOW + } opts.Mappable = m opts.MappingIdentity = file file.IncRef() |