Skip to content

Commit 831ce64

Browse files
authored
Merge commit from fork
Fix overflow in JRuby extension
2 parents aafc033 + 32e687e commit 831ce64

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
3.1.22 Mar 18 2026
2+
- [CVE-2026-33306] Fix integer overflow in Java extension
3+
14
3.1.21 Dec 31 2025
25
- Use constant time comparisons
36
- Mark as Ractor safe

bcrypt.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'bcrypt'
3-
s.version = '3.1.21'
3+
s.version = '3.1.22'
44

55
s.summary = "OpenBSD's bcrypt() password hashing algorithm."
66
s.description = <<-EOF

ext/jruby/bcrypt_jruby/BCrypt.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,20 +688,21 @@ static long roundsForLogRounds(int log_rounds) {
688688
*/
689689
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds,
690690
boolean sign_ext_bug, int safety) {
691-
int rounds, i, j;
691+
long rounds;
692+
int i, j;
692693
int cdata[] = bf_crypt_ciphertext.clone();
693694
int clen = cdata.length;
694695
byte ret[];
695696

696697
if (log_rounds < 4 || log_rounds > 31)
697698
throw new IllegalArgumentException ("Bad number of rounds");
698-
rounds = 1 << log_rounds;
699+
rounds = roundsForLogRounds(log_rounds);
699700
if (salt.length != BCRYPT_SALT_LEN)
700701
throw new IllegalArgumentException ("Bad salt length");
701702

702703
init_key();
703704
ekskey(salt, password, sign_ext_bug, safety);
704-
for (i = 0; i < rounds; i++) {
705+
for (long r = 0; r < rounds; r++) {
705706
key(password, sign_ext_bug, safety);
706707
key(salt, false, safety);
707708
}

0 commit comments

Comments
 (0)