Skip to content

Commit 4e2e4a1

Browse files
committed
Clamp output size to config max if not 0
1 parent 38b50a5 commit 4e2e4a1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ public String render(Node root, boolean processExtendRoots) {
301301
* @return rendered result
302302
*/
303303
private String render(Node root, boolean processExtendRoots, long renderLimit) {
304-
OutputList output = new OutputList(renderLimit);
304+
long safeRenderSize = (config.getMaxOutputSize() == 0)
305+
? renderLimit
306+
: Math.min(renderLimit, config.getMaxOutputSize());
307+
OutputList output = new OutputList(safeRenderSize);
305308
for (Node node : root.getChildren()) {
306309
lineNumber = node.getLineNumber();
307310
position = node.getStartPosition();

0 commit comments

Comments
 (0)