-
Notifications
You must be signed in to change notification settings - Fork 3.6k
improvement(sandbox): upgrade pptx/docx/pdf bootstrap with image helpers, MIME guards, and 256 MB isolate limit #4505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
508edf6
9e38939
f3f1a45
86c6ba8
918954a
449ed27
20c2341
925d2ba
b7db38a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,7 +183,7 @@ async function executeCode(request, executionId) { | |
| const externalCopies = [] | ||
|
|
||
| try { | ||
| isolate = new ivm.Isolate({ memoryLimit: 128 }) | ||
| isolate = new ivm.Isolate({ memoryLimit: 256 }) | ||
| if (executionId !== undefined) activeIsolates.set(executionId, isolate) | ||
| context = await isolate.createContext() | ||
| const jail = context.global | ||
|
|
@@ -398,6 +398,21 @@ async function executeCode(request, executionId) { | |
| } | ||
| } | ||
|
|
||
| if ( | ||
| err.message.includes('Array buffer allocation failed') || | ||
| err.message.includes('memory limit') | ||
| ) { | ||
| return { | ||
| result: null, | ||
| stdout, | ||
| error: { | ||
| message: | ||
| 'Execution exceeded memory limit (256 MB). Reduce image sizes or split the work into smaller batches.', | ||
| name: 'MemoryLimitError', | ||
| }, | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OOM check is unreachable due to isDisposed orderingHigh Severity The new Additional Locations (1)Reviewed by Cursor Bugbot for commit b7db38a. Configure here. |
||
|
|
||
| return { | ||
| result: null, | ||
| stdout, | ||
|
|
@@ -511,7 +526,7 @@ async function executeTask(request, executionId) { | |
| let tPhase = tStart | ||
|
|
||
| try { | ||
| isolate = new ivm.Isolate({ memoryLimit: 128 }) | ||
| isolate = new ivm.Isolate({ memoryLimit: 256 }) | ||
| if (executionId !== undefined) activeIsolates.set(executionId, isolate) | ||
| context = await isolate.createContext() | ||
| const jail = context.global | ||
|
|
@@ -937,6 +952,23 @@ async function executeTask(request, executionId) { | |
| timings, | ||
| } | ||
| } | ||
|
|
||
| if ( | ||
| err.message?.includes('Array buffer allocation failed') || | ||
| err.message?.includes('memory limit') | ||
| ) { | ||
| return { | ||
| result: null, | ||
| stdout, | ||
| error: { | ||
| message: | ||
| 'Execution exceeded memory limit (256 MB). Reduce image sizes or split the work into smaller batches.', | ||
| name: 'MemoryLimitError', | ||
| }, | ||
| timings, | ||
| } | ||
| } | ||
|
waleedlatif1 marked this conversation as resolved.
|
||
|
|
||
| return { | ||
| result: null, | ||
| stdout, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.