cgildea / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

Maximum call stack exceeded #90

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use CryptoJS to compute an MD5 inside a web worker with particular file sizes

What is the expected output? What do you see instead?
I expected to get an MD5, but instead got a maximum call stack exceeded error.

What version of the product are you using? On what operating system?
3.1.2 on chrome linux.

Please provide any additional information below.

Here is a patch which fixes it. For some reason this only happens in a web 
worker, perhaps the limits to fn.apply are less in the web worker environment?..

Index: core.js
===================================================================
--- core.js (revision 664)
+++ core.js (working copy)
@@ -217,7 +217,9 @@
                 }
             } else {
                 // Copy all words at once
-                thisWords.push.apply(thisWords, thatWords);
+                for (var i = 0; i < thatWords.length) {
+                  thisWords.push(thatWords[i]);
+                }
             }
             this.sigBytes += thatSigBytes;

Original issue reported on code.google.com by e...@dnanexus.com on 9 Jul 2013 at 8:52

GoogleCodeExporter commented 9 years ago
To make my job easier, could you attach code that reproduces the issue?

Original comment by Jeff.Mott.OR on 9 Jul 2013 at 9:13

GoogleCodeExporter commented 9 years ago
Sorry it took a while. It was a lot of work to extract a minimal example from 
our application. Attached is everything you need to provoke the issue.

A few things you will need to do to use this example
1) Either serve this directory from a web server or using file:/// with web 
security disabled in chrome
2) Update the path in index.html to the core.js and md5.js accordingly

After you see the error, replace core.js in the importScript with core2.js to 
see the fix in action.

Let me know if you have any questions,
Evan

Original comment by e...@dnanexus.com on 9 Jul 2013 at 9:48

Attachments:

GoogleCodeExporter commented 9 years ago
Also, use the SRR file as the test. It needs to be a file size that is not % 4.

Original comment by e...@dnanexus.com on 9 Jul 2013 at 9:49