[SERVER-8961] Differences in argument validation of custom types between v8 and Spidermonkey Created: 13/Mar/13  Updated: 11/Jul/16  Resolved: 10/Jul/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 2.5.1

Type: Bug Priority: Trivial - P5
Reporter: Shaun Verch Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
Operating System: ALL
Participants:

 Description   

DBRef():

v8:

> DBRef()
DBRef(undefined, undefined)

Spidermonkey:

> DBRef()
Tue Mar 12 18:15:20.990 Error: DBRef takes 2 arguments -- DBRef($ref,$id) (shell):1

BinData():

v8:

> BinData()
BinData(0,"")
> new BinData()
BinData(0,"")

Spidermonkey:

> BinData()
Tue Mar 12 18:16:53.444 Error: BinData takes 2 arguments -- BinData(subtype,data) (shell):1
> new BinData()
Tue Mar 12 18:16:54.636 Error: BinData takes 2 arguments -- BinData(subtype,data) (shell):1

DBPointer argument checking:

v8:

> DBPointer("ns",0)
DBPointer("ns", 0)
> DBPointer("ns","test")
DBPointer("ns", "test")

Spidermonkey:

> DBPointer("ns",0)
Tue Mar 12 18:17:52.499 Error: 2nd argument to DBPointer must be objectId (shell):1
> DBPointer("ns","test")
Tue Mar 12 18:17:55.506 Error: 2nd argument to DBPointer must be objectId (shell):1



 Comments   
Comment by auto [ 19/Jun/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-9878 Add type checks to V8 C++ bindings

The main focus of this ticket is tightening up input validation in
our V8 bindings. Doing this required normalizing the way we create
custom types in JS that have special C++-driven behavior. All special
types now use FunctionTemplates that are attached to the V8Scope object.
This allows us to test if an object is of the correct type before using
it.

Other related tickets partially addressed:
SERVER-8961 Differences in argument validation of custom types between v8 and Spidermonkey
SERVER-9803 Handle regular expression parse errors without seg faulting

Conflicts:

jstests/constructors.js
src/mongo/scripting/engine_v8.cpp
Branch: v2.4
https://github.com/mongodb/mongo/commit/7c1b35e0b2cc69c93074c6d1d76879b3ed525f56

Comment by auto [ 17/Jun/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-9878 Add type checks to V8 C++ bindings

The main focus of this ticket is tightening up input validation in
our V8 bindings. Doing this required normalizing the way we create
custom types in JS that have special C++-driven behavior. All special
types now use FunctionTemplates that are attached to the V8Scope object.
This allows us to test if an object is of the correct type before using
it.

Other related tickets partially addressed:
SERVER-8961 Differences in argument validation of custom types between v8 and Spidermonkey
SERVER-9803 Handle regular expression parse errors without seg faulting
Branch: master
https://github.com/mongodb/mongo/commit/fda4a2342614e4ca1fb26c868a5adef0e050eb5e

Comment by Daniel Pasette (Inactive) [ 09/May/13 ]

Glancing at the code, it seems we intended to require arg validation, but now we do it inconsistently. This is low priority but should be consistent across types.

Comment by auto [ 29/Mar/13 ]

Author:

{u'date': u'2013-03-13T02:29:34Z', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-8961 Comment out constructors that fail on Spidermonkey
Branch: master
https://github.com/mongodb/mongo/commit/0938eb923f522452e2c2918c6e89911355913bec

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