summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorKai Groner <kai@gronr.com>2013-04-18 19:01:14 -0400
committerFedor Indutny <fedor.indutny@gmail.com>2013-12-04 19:52:15 +0400
commit98be8df571f92ad0b846209c21cc00139bc14805 (patch)
tree0b36a1d114063b747f8ae7955b4a991bf4f77252 /lib/crypto.js
parentb371d4ae8fdbf1b9046b9076cae1ee5fdc196724 (diff)
downloadandroid-node-v8-98be8df571f92ad0b846209c21cc00139bc14805.tar.gz
android-node-v8-98be8df571f92ad0b846209c21cc00139bc14805.tar.bz2
android-node-v8-98be8df571f92ad0b846209c21cc00139bc14805.zip
crypto: Make Decipher._flush() emit errors.
When Decipher processes a stream using an incorrect key, the DecipherFinal() method throws an unhandled exception at the end of the stream.
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 0cc70ff15a..22141ff8ae 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -263,7 +263,12 @@ Cipher.prototype._transform = function(chunk, encoding, callback) {
};
Cipher.prototype._flush = function(callback) {
- this.push(this._binding.final());
+ try {
+ this.push(this._binding.final());
+ } catch (e) {
+ callback(e);
+ return;
+ }
callback();
};