Revision: 5487
Author: erights
Date: Sat Jul 13 09:31:10 2013
Log: Fixes Nat to be safe for normal uses.
https://codereview.appspot.com/10709046
Fixes https://code.google.com/p/google-caja/issues/detail?id=1801
[email protected]
http://code.google.com/p/google-caja/source/detail?r=5487
Modified:
/trunk/src/com/google/caja/ses/startSES.js
=======================================
--- /trunk/src/com/google/caja/ses/startSES.js Sat Jul 13 08:35:24 2013
+++ /trunk/src/com/google/caja/ses/startSES.js Sat Jul 13 09:31:10 2013
@@ -495,7 +495,19 @@
// we make the global object be the Window which inherits
Object.prototype,
// and is not a security risk since the properties are ambiently
available.
- var MAX_NAT = Math.pow(2, 53);
+ var MAX_NAT = Math.pow(2, 53) - 1;
+
+ /**
+ * Is allegenNum a number in the contiguous range of exactly and
+ * unambiguously representable natural numbers (non-negative integers)?
+ *
+ * <p>See <a href=
+ * "https://code.google.com/p/google-caja/issues/detail?id=1801"
+ * >Issue 1801: Nat must include at most (2**53)-1</a>
+ * and <a href=
+ * "https://mail.mozilla.org/pipermail/es-discuss/2013-July/031716.html"
+ * >Allen Wirfs-Brock's suggested phrasing</a> on es-discuss.
+ */
function Nat(allegedNum) {
if (typeof allegedNum !== 'number') {
throw new RangeError('not a number');
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.