Skip to content

Commit 2f5332f

Browse files
committed
Make cipher field in AESCipher and AESCipherCBCnoPad thread safe
DEVSIX-8435 Autoported commit. Original commit hash: [cecbc2716] Manual files: kernel/src/main/java/com/itextpdf/kernel/crypto/AESCipher.java kernel/src/main/java/com/itextpdf/kernel/crypto/AESCipherCBCnoPad.java kernel/src/main/java/com/itextpdf/kernel/crypto/securityhandler/EncryptionUtils.java sign/src/main/java/com/itextpdf/signatures/validation/v1/SignatureValidationProperties.java
1 parent c6432b3 commit 2f5332f

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

itext/itext.kernel/itext/kernel/crypto/AESCipherCBCnoPad.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You should have received a copy of the GNU Affero General Public License
2626
namespace iText.Kernel.Crypto {
2727
/// <summary>Creates an AES Cipher with CBC and no padding.</summary>
2828
public class AESCipherCBCnoPad {
29-
private static ICipherCBCnoPad cipher;
29+
private ICipherCBCnoPad cipher;
3030

3131
/// <summary>Creates a new instance of AESCipher with CBC and no padding</summary>
3232
/// <param name="forEncryption">

itext/itext.kernel/itext/kernel/pdf/PdfNumTree.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public virtual PdfDictionary BuildTree() {
7575
if (numbers.Length <= NODE_SIZE) {
7676
PdfDictionary dic = new PdfDictionary();
7777
PdfArray ar = new PdfArray();
78-
for (int k = 0; k < numbers.Length; ++k) {
79-
ar.Add(new PdfNumber((int)numbers[k]));
80-
ar.Add(items.Get(numbers[k]));
78+
foreach (int? number in numbers) {
79+
ar.Add(new PdfNumber((int)number));
80+
ar.Add(items.Get(number));
8181
}
8282
dic.Put(PdfName.Nums, ar);
8383
return dic;

itext/itext.kernel/itext/kernel/pdf/PdfWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public PdfWriter(String filename, WriterProperties properties)
9494
/// <summary>Indicates if to use full compression mode.</summary>
9595
/// <returns>true if to use full compression, false otherwise.</returns>
9696
public virtual bool IsFullCompression() {
97-
return properties.isFullCompression != null ? (bool)properties.isFullCompression : false;
97+
return properties.isFullCompression != null && (bool)properties.isFullCompression;
9898
}
9999

100100
/// <summary>Gets default compression level for @see PdfStream.</summary>

itext/itext.sign/itext/signatures/validation/v1/SafeCalling.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public static void OnExceptionLog(Action action, ValidationReport report, Func<E
4848
/// <param name="defaultValue">The value to return when an exception is thrown</param>
4949
/// <param name="report">The report to add the ReportItem to</param>
5050
/// <param name="reportItemCreator">A callback to generate a ReportItem</param>
51-
/// <returns>The returned value from the action</returns>
5251
/// <typeparam name="T"/>
52+
/// <returns>The returned value from the action</returns>
5353
public static T OnExceptionLog<T>(Func<T> action, T defaultValue, ValidationReport report, Func<Exception,
5454
ReportItem> reportItemCreator) {
5555
try {
@@ -80,8 +80,8 @@ public static void OnRuntimeExceptionLog(Action action, ValidationReport report,
8080
/// <param name="defaultValue">The value to return when an exception is thrown</param>
8181
/// <param name="report">The report to add the ReportItem to</param>
8282
/// <param name="reportItemCreator">A callback to generate a ReportItem</param>
83-
/// <returns>The returned value from the action</returns>
8483
/// <typeparam name="T"/>
84+
/// <returns>The returned value from the action</returns>
8585
public static T OnRuntimeExceptionLog<T>(Func<T> action, T defaultValue, ValidationReport report, Func<Exception
8686
, ReportItem> reportItemCreator) {
8787
try {

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5a8f86d5e1ee424e95f9bae23d0ae30f8a971989
1+
cecbc27166eb8d323051127a3436131ba4993639

0 commit comments

Comments
 (0)