Permalink
Browse files

Guard for JS number size overflows.

If you hit the maximum of a JS integer, math starts getting wonky. We
make sure at that point we wrap to 0.
  • Loading branch information...
Shadowfiend authored and nafg committed Sep 28, 2012
1 parent b86cb60 commit 63456622ce9dc98422f1401689fe281cfe46bfd9
Showing with 5 additions and 0 deletions.
  1. +5 −0 web/webkit/src/main/scala/net/liftweb/http/js/ScriptRenderer.scala
@@ -48,6 +48,11 @@ object ScriptRenderer {
toSend.responseType = responseType;
toSend.version = liftAjax.lift_ajaxVersion++;
+ // Make sure we wrap when we hit JS max int.
+ var version = liftAjax.lift_ajaxVersion
+ if ((version - (version + 1) != -1) || (version - (version - 1) != 1))
+ liftAjax.lift_ajaxVersion = 0;
+
if (liftAjax.lift_uriSuffix) {
theData += '&' + liftAjax.lift_uriSuffix;
toSend.theData = theData;

0 comments on commit 6345662

Please sign in to comment.