Skip to content

Commit

Permalink
Make cipher field in AESCipher and AESCipherCBCnoPad thread safe
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AnhelinaM committed Jul 10, 2024
1 parent c6432b3 commit 2f5332f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You should have received a copy of the GNU Affero General Public License
namespace iText.Kernel.Crypto {
/// <summary>Creates an AES Cipher with CBC and no padding.</summary>
public class AESCipherCBCnoPad {
private static ICipherCBCnoPad cipher;
private ICipherCBCnoPad cipher;

/// <summary>Creates a new instance of AESCipher with CBC and no padding</summary>
/// <param name="forEncryption">
Expand Down
6 changes: 3 additions & 3 deletions itext/itext.kernel/itext/kernel/pdf/PdfNumTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public virtual PdfDictionary BuildTree() {
if (numbers.Length <= NODE_SIZE) {
PdfDictionary dic = new PdfDictionary();
PdfArray ar = new PdfArray();
for (int k = 0; k < numbers.Length; ++k) {
ar.Add(new PdfNumber((int)numbers[k]));
ar.Add(items.Get(numbers[k]));
foreach (int? number in numbers) {
ar.Add(new PdfNumber((int)number));
ar.Add(items.Get(number));
}
dic.Put(PdfName.Nums, ar);
return dic;
Expand Down
2 changes: 1 addition & 1 deletion itext/itext.kernel/itext/kernel/pdf/PdfWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public PdfWriter(String filename, WriterProperties properties)
/// <summary>Indicates if to use full compression mode.</summary>
/// <returns>true if to use full compression, false otherwise.</returns>
public virtual bool IsFullCompression() {
return properties.isFullCompression != null ? (bool)properties.isFullCompression : false;
return properties.isFullCompression != null && (bool)properties.isFullCompression;
}

/// <summary>Gets default compression level for @see PdfStream.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public static void OnExceptionLog(Action action, ValidationReport report, Func<E
/// <param name="defaultValue">The value to return when an exception is thrown</param>
/// <param name="report">The report to add the ReportItem to</param>
/// <param name="reportItemCreator">A callback to generate a ReportItem</param>
/// <returns>The returned value from the action</returns>
/// <typeparam name="T"/>
/// <returns>The returned value from the action</returns>
public static T OnExceptionLog<T>(Func<T> action, T defaultValue, ValidationReport report, Func<Exception,
ReportItem> reportItemCreator) {
try {
Expand Down Expand Up @@ -80,8 +80,8 @@ public static void OnRuntimeExceptionLog(Action action, ValidationReport report,
/// <param name="defaultValue">The value to return when an exception is thrown</param>
/// <param name="report">The report to add the ReportItem to</param>
/// <param name="reportItemCreator">A callback to generate a ReportItem</param>
/// <returns>The returned value from the action</returns>
/// <typeparam name="T"/>
/// <returns>The returned value from the action</returns>
public static T OnRuntimeExceptionLog<T>(Func<T> action, T defaultValue, ValidationReport report, Func<Exception
, ReportItem> reportItemCreator) {
try {
Expand Down
2 changes: 1 addition & 1 deletion port-hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5a8f86d5e1ee424e95f9bae23d0ae30f8a971989
cecbc27166eb8d323051127a3436131ba4993639

0 comments on commit 2f5332f

Please sign in to comment.