Browse Source

Fixed callstack overflow

CryptoJS hotfix from
https://code.google.com/p/crypto-js/issues/detail?id=90
master
Igor Zhukov 11 years ago
parent
commit
cf5a4a4c21
  1. 4
      app/index.html
  2. 2
      app/js/lib/aes_worker.js
  3. 10
      app/js/lib/mtproto.js
  4. 2
      app/js/lib/sha1_worker.js
  5. 7
      app/vendor/cryptoJS/crypto.js

4
app/index.html

@ -43,12 +43,12 @@ @@ -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/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="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/app.js?5"></script>

2
app/js/lib/aes_worker.js

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

10
app/js/lib/mtproto.js

@ -1131,7 +1131,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu @@ -1131,7 +1131,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu
mtpSendReqDhParams(auth);
};
worker.onerror = function(error) {
console.log('Worker error', error);
console.log('Worker error', error, error.stack);
deferred.reject(error);
};
worker.postMessage(auth.pq)
@ -1417,7 +1417,7 @@ factory('MtpAesService', function ($q) { @@ -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,
awaiting = {};
@ -1430,7 +1430,7 @@ factory('MtpAesService', function ($q) { @@ -1430,7 +1430,7 @@ factory('MtpAesService', function ($q) {
// console.log('AES worker message', e.data, deferred);
};
worker.onerror = function(error) {
console.log('AES Worker error', error);
console.log('AES Worker error', error, error.stack);
};
return {
@ -1469,7 +1469,7 @@ factory('MtpSha1Service', function ($q) { @@ -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,
awaiting = {};
@ -1482,7 +1482,7 @@ factory('MtpSha1Service', function ($q) { @@ -1482,7 +1482,7 @@ factory('MtpSha1Service', function ($q) {
// console.log('sha1 got message', e.data, deferred);
};
worker.onerror = function(error) {
console.log('SHA-1 Worker error', error);
console.log('SHA-1 Worker error', error, error.stack);
};
return {

2
app/js/lib/sha1_worker.js

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

7
app/vendor/cryptoJS/crypto.js vendored

@ -223,7 +223,12 @@ var CryptoJS = CryptoJS || (function (Math, undefined) { @@ -223,7 +223,12 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
}
} else {
// 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;

Loading…
Cancel
Save