|
| 1 | +From 33df26b5771e824f303a79ec6407409376baa64b Mon Sep 17 00:00:00 2001 |
| 2 | +From: Kirill Fomichev <fanatid@ya.ru> |
| 3 | +Date: Wed, 18 Feb 2026 20:38:33 -0500 |
| 4 | +Subject: [PATCH] Fix CVE-2026-2739 by Kirill Fomichev |
| 5 | + |
| 6 | +Upstream Patch Reference: https://github.com/indutny/bn.js/commit/33df26b5771e824f303a79ec6407409376baa64b.patch |
| 7 | +--- |
| 8 | + src/ui/node_modules/asn1.js/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 9 | + src/ui/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 10 | + src/ui/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 11 | + .../node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 12 | + src/ui/node_modules/elliptic/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 13 | + .../node_modules/miller-rabin/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 14 | + .../node_modules/public-encrypt/node_modules/bn.js/lib/bn.js | 5 +++++ |
| 15 | + 7 files changed, 35 insertions(+) |
| 16 | + |
| 17 | +diff --git a/src/ui/node_modules/asn1.js/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/asn1.js/node_modules/bn.js/lib/bn.js |
| 18 | +index 3a4371ea..f580acf1 100644 |
| 19 | +--- a/src/ui/node_modules/asn1.js/node_modules/bn.js/lib/bn.js |
| 20 | ++++ b/src/ui/node_modules/asn1.js/node_modules/bn.js/lib/bn.js |
| 21 | +@@ -2128,6 +2128,11 @@ |
| 22 | + this.words[this.length - 1] &= mask; |
| 23 | + } |
| 24 | + |
| 25 | ++ if (this.length === 0) { |
| 26 | ++ this.words[0] = 0; |
| 27 | ++ this.length = 1; |
| 28 | ++ } |
| 29 | ++ |
| 30 | + return this.strip(); |
| 31 | + }; |
| 32 | + |
| 33 | +diff --git a/src/ui/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/bn.js/lib/bn.js |
| 34 | +index adecc949..48e0e2e3 100644 |
| 35 | +--- a/src/ui/node_modules/bn.js/lib/bn.js |
| 36 | ++++ b/src/ui/node_modules/bn.js/lib/bn.js |
| 37 | +@@ -2215,6 +2215,11 @@ |
| 38 | + this.words[this.length - 1] &= mask; |
| 39 | + } |
| 40 | + |
| 41 | ++ if (this.length === 0) { |
| 42 | ++ this.words[0] = 0; |
| 43 | ++ this.length = 1; |
| 44 | ++ } |
| 45 | ++ |
| 46 | + return this._strip(); |
| 47 | + }; |
| 48 | + |
| 49 | +diff --git a/src/ui/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js |
| 50 | +index 3a4371ea..04349f6d 100644 |
| 51 | +--- a/src/ui/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js |
| 52 | ++++ b/src/ui/node_modules/create-ecdh/node_modules/bn.js/lib/bn.js |
| 53 | +@@ -2128,6 +2128,11 @@ |
| 54 | + this.words[this.length - 1] &= mask; |
| 55 | + } |
| 56 | + |
| 57 | ++ if (this.length === 0) { |
| 58 | ++ this.words[0] = 0; |
| 59 | ++ this.length = 1; |
| 60 | ++ } |
| 61 | ++ |
| 62 | + return this.strip(); |
| 63 | + }; |
| 64 | + |
| 65 | +diff --git a/src/ui/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js |
| 66 | +index 3a4371ea..04349f6d 100644 |
| 67 | +--- a/src/ui/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js |
| 68 | ++++ b/src/ui/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js |
| 69 | +@@ -2128,6 +2128,11 @@ |
| 70 | + this.words[this.length - 1] &= mask; |
| 71 | + } |
| 72 | + |
| 73 | ++ if (this.length === 0) { |
| 74 | ++ this.words[0] = 0; |
| 75 | ++ this.length = 1; |
| 76 | ++ } |
| 77 | ++ |
| 78 | + return this.strip(); |
| 79 | + }; |
| 80 | + |
| 81 | +diff --git a/src/ui/node_modules/elliptic/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/elliptic/node_modules/bn.js/lib/bn.js |
| 82 | +index 3a4371ea..04349f6d 100644 |
| 83 | +--- a/src/ui/node_modules/elliptic/node_modules/bn.js/lib/bn.js |
| 84 | ++++ b/src/ui/node_modules/elliptic/node_modules/bn.js/lib/bn.js |
| 85 | +@@ -2128,6 +2128,11 @@ |
| 86 | + this.words[this.length - 1] &= mask; |
| 87 | + } |
| 88 | + |
| 89 | ++ if (this.length === 0) { |
| 90 | ++ this.words[0] = 0; |
| 91 | ++ this.length = 1; |
| 92 | ++ } |
| 93 | ++ |
| 94 | + return this.strip(); |
| 95 | + }; |
| 96 | + |
| 97 | +diff --git a/src/ui/node_modules/miller-rabin/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/miller-rabin/node_modules/bn.js/lib/bn.js |
| 98 | +index 3a4371ea..04349f6d 100644 |
| 99 | +--- a/src/ui/node_modules/miller-rabin/node_modules/bn.js/lib/bn.js |
| 100 | ++++ b/src/ui/node_modules/miller-rabin/node_modules/bn.js/lib/bn.js |
| 101 | +@@ -2128,6 +2128,11 @@ |
| 102 | + this.words[this.length - 1] &= mask; |
| 103 | + } |
| 104 | + |
| 105 | ++ if (this.length === 0) { |
| 106 | ++ this.words[0] = 0; |
| 107 | ++ this.length = 1; |
| 108 | ++ } |
| 109 | ++ |
| 110 | + return this.strip(); |
| 111 | + }; |
| 112 | + |
| 113 | +diff --git a/src/ui/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js b/src/ui/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js |
| 114 | +index 3a4371ea..04349f6d 100644 |
| 115 | +--- a/src/ui/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js |
| 116 | ++++ b/src/ui/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js |
| 117 | +@@ -2128,6 +2128,11 @@ |
| 118 | + this.words[this.length - 1] &= mask; |
| 119 | + } |
| 120 | + |
| 121 | ++ if (this.length === 0) { |
| 122 | ++ this.words[0] = 0; |
| 123 | ++ this.length = 1; |
| 124 | ++ } |
| 125 | ++ |
| 126 | + return this.strip(); |
| 127 | + }; |
| 128 | + |
| 129 | +-- |
| 130 | +2.45.4 |
| 131 | + |
0 commit comments