Skip to content

Commit

Permalink
Merge pull request brix#87 from evilboxingdragonslayer/develop
Browse files Browse the repository at this point in the history
fixed infinite loop bug in zero padding unpad
  • Loading branch information
evanvosberg authored Sep 13, 2018
2 parents 52f7128 + 5bfe6d5 commit 4b7673e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pad-zeropadding.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ CryptoJS.pad.ZeroPadding = {

// Unpad
var i = data.sigBytes - 1;
while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
i--;
for (var i = data.sigBytes - 1; i >= 0; i--) {
if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
data.sigBytes = i + 1;
break;
}
}
data.sigBytes = i + 1;
}
};

0 comments on commit 4b7673e

Please sign in to comment.