[SERVER-15032] Mongo shell should reject script file larger than 2G Created: 25/Aug/14  Updated: 22/Jul/15  Resolved: 30/Aug/14

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.6.3
Fix Version/s: 2.7.6

Type: Bug Priority: Trivial - P5
Reporter: Siyuan Zhou Assignee: Benety Goh
Resolution: Done Votes: 1
Labels: community-team, polish
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Operating System: ALL
Sprint: Server 2.7.4, Server 2.7.5, Server 2.7.6
Participants:

 Description   

Reported by a user here.

The shell reads the whole script file into memory and compile it, so shell doesn't allow script file to exceed 2G to keep the compatibility on 32bit OS. But the current limit is about 4G.

Also when reading a file in file.cpp, pread() doesn't guarantee reading until the EOF in one shot. It should be checked in a loop until the EOF or an error.

2014-08-19T21:49:28.069-0400 Assertion: 16569:In File::read(), ::pread for 'univ100-100.js' read 2147479552 bytes while trying to read 2364826029 bytes starting at offset 0, truncated file?



 Comments   
Comment by Benety Goh [ 30/Aug/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-15032 removed unnecessary 'static' qualification for variable in unnamed namespace.
Branch: master
https://github.com/mongodb/mongo/commit/79626bc249484368fe4d9369ec52f7df70e6a726

Comment by Githook User [ 30/Aug/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-15032 enforce 2GB file limit for Javascript files passed to shell
Branch: master
https://github.com/mongodb/mongo/commit/166b061a60bd3399e60009934e1898e6006f4004

Comment by Matt Kangas [ 29/Aug/14 ]

The current error message still says "attempted to execute javascript file larger than 2GB". Let's enforce that limit.

A limit less than 2 GB would be sensible but will be a breaking change for some users, so we cannot change this arbitrarily.

Generated at Thu Feb 08 03:36:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.