mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-27 06:39:24 +00:00
Introduced protections against predictable RNG abuse
This commit is contained in:
parent
41dd04a4cc
commit
86783cf573
@ -7,6 +7,7 @@ import java.awt.geom.AffineTransform;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
@ -45,7 +46,7 @@ import stirling.software.common.util.WebResponseUtils;
|
|||||||
public class FakeScanController {
|
public class FakeScanController {
|
||||||
|
|
||||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new SecureRandom();
|
||||||
|
|
||||||
// Size limits to prevent OutOfMemoryError
|
// Size limits to prevent OutOfMemoryError
|
||||||
private static final int MAX_IMAGE_WIDTH = 8192;
|
private static final int MAX_IMAGE_WIDTH = 8192;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user