Fixed callstack overflow

CryptoJS hotfix from
https://code.google.com/p/crypto-js/issues/detail?id=90
This commit is contained in:
Igor Zhukov 2014-01-27 01:58:22 +04:00
parent 9af460a664
commit cf5a4a4c21
5 changed files with 15 additions and 10 deletions

View File

@ -43,12 +43,12 @@
<script type="text/javascript" src="vendor/ui-bootstrap/ui-bootstrap-custom-tpls-0.7.0.js?2"></script> <script type="text/javascript" src="vendor/ui-bootstrap/ui-bootstrap-custom-tpls-0.7.0.js?2"></script>
<script type="text/javascript" src="vendor/jsbn/jsbn_combined.js"></script> <script type="text/javascript" src="vendor/jsbn/jsbn_combined.js"></script>
<script type="text/javascript" src="vendor/cryptoJS/crypto.js"></script> <script type="text/javascript" src="vendor/cryptoJS/crypto.js?1"></script>
<script type="text/javascript" src="vendor/zlib/gunzip.min.js"></script> <script type="text/javascript" src="vendor/zlib/gunzip.min.js"></script>
<script type="text/javascript" src="js/lib/config.js"></script> <script type="text/javascript" src="js/lib/config.js"></script>
<script type="text/javascript" src="js/lib/mtproto.js?15"></script> <script type="text/javascript" src="js/lib/mtproto.js?16"></script>
<script type="text/javascript" src="js/util.js"></script> <script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/app.js?5"></script> <script type="text/javascript" src="js/app.js?5"></script>

View File

@ -9,7 +9,7 @@ importScripts(
'../../vendor/console-polyfill/console-polyfill.js?1', '../../vendor/console-polyfill/console-polyfill.js?1',
'mtproto.js', 'mtproto.js',
'../../vendor/jsbn/jsbn_combined.js', '../../vendor/jsbn/jsbn_combined.js',
'../../vendor/cryptoJS/crypto.js' '../../vendor/cryptoJS/crypto.js?1'
); );
onmessage = function (e) { onmessage = function (e) {

View File

@ -1131,7 +1131,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu
mtpSendReqDhParams(auth); mtpSendReqDhParams(auth);
}; };
worker.onerror = function(error) { worker.onerror = function(error) {
console.log('Worker error', error); console.log('Worker error', error, error.stack);
deferred.reject(error); deferred.reject(error);
}; };
worker.postMessage(auth.pq) worker.postMessage(auth.pq)
@ -1417,7 +1417,7 @@ factory('MtpAesService', function ($q) {
}; };
} }
var worker = new Worker('js/lib/aes_worker.js?1'), var worker = new Worker('js/lib/aes_worker.js?2'),
taskID = 0, taskID = 0,
awaiting = {}; awaiting = {};
@ -1430,7 +1430,7 @@ factory('MtpAesService', function ($q) {
// console.log('AES worker message', e.data, deferred); // console.log('AES worker message', e.data, deferred);
}; };
worker.onerror = function(error) { worker.onerror = function(error) {
console.log('AES Worker error', error); console.log('AES Worker error', error, error.stack);
}; };
return { return {
@ -1469,7 +1469,7 @@ factory('MtpSha1Service', function ($q) {
}; };
} }
var worker = new Worker('js/lib/sha1_worker.js?1'), var worker = new Worker('js/lib/sha1_worker.js?2'),
taskID = 0, taskID = 0,
awaiting = {}; awaiting = {};
@ -1482,7 +1482,7 @@ factory('MtpSha1Service', function ($q) {
// console.log('sha1 got message', e.data, deferred); // console.log('sha1 got message', e.data, deferred);
}; };
worker.onerror = function(error) { worker.onerror = function(error) {
console.log('SHA-1 Worker error', error); console.log('SHA-1 Worker error', error, error.stack);
}; };
return { return {

View File

@ -8,7 +8,7 @@
importScripts( importScripts(
'../../vendor/console-polyfill/console-polyfill.js?1', '../../vendor/console-polyfill/console-polyfill.js?1',
'mtproto.js', 'mtproto.js',
'../../vendor/cryptoJS/crypto.js' '../../vendor/cryptoJS/crypto.js?1'
); );
onmessage = function (e) { onmessage = function (e) {

View File

@ -223,7 +223,12 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
} }
} else { } else {
// Copy all words at once // Copy all words at once
thisWords.push.apply(thisWords, thatWords); // thisWords.push.apply(thisWords, thatWords);
// HOTFIX from: https://code.google.com/p/crypto-js/issues/detail?id=90
for (var i = 0; i < thatWords.length; i++) {
thisWords.push(thatWords[i]);
}
} }
this.sigBytes += thatSigBytes; this.sigBytes += thatSigBytes;