mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-17 12:40:11 +01:00
Merge pull request #766 from Stirling-Tools/pixeebot/drip-2024-02-01-pixee-java/limit-readline
Protect `readLine()` against DoS
This commit is contained in:
commit
6105451e08
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.SPDF.utils;
|
package stirling.software.SPDF.utils;
|
||||||
|
|
||||||
|
import io.github.pixee.security.BoundedLineReader;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -109,7 +110,7 @@ public class ProcessExecutor {
|
|||||||
process.getErrorStream(),
|
process.getErrorStream(),
|
||||||
StandardCharsets.UTF_8))) {
|
StandardCharsets.UTF_8))) {
|
||||||
String line;
|
String line;
|
||||||
while ((line = errorReader.readLine()) != null) {
|
while ((line = BoundedLineReader.readLine(errorReader, 5_000_000)) != null) {
|
||||||
errorLines.add(line);
|
errorLines.add(line);
|
||||||
if (liveUpdates) logger.info(line);
|
if (liveUpdates) logger.info(line);
|
||||||
}
|
}
|
||||||
@ -130,7 +131,7 @@ public class ProcessExecutor {
|
|||||||
process.getInputStream(),
|
process.getInputStream(),
|
||||||
StandardCharsets.UTF_8))) {
|
StandardCharsets.UTF_8))) {
|
||||||
String line;
|
String line;
|
||||||
while ((line = outputReader.readLine()) != null) {
|
while ((line = BoundedLineReader.readLine(outputReader, 5_000_000)) != null) {
|
||||||
outputLines.add(line);
|
outputLines.add(line);
|
||||||
if (liveUpdates) logger.info(line);
|
if (liveUpdates) logger.info(line);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user