Skip to content

toLocaleDateString() crashes embedded V8 with SIGTRAP #70

@maciej-trebacz

Description

@maciej-trebacz

Calling locale-aware date formatting inside secure-exec crashes the embedded V8 runtime process instead of returning a normal JS exception.

Repro:

const runtime = new NodeRuntime({
  systemDriver: createNodeDriver({
    permissions: allowAll,
    processConfig: {
      cwd: "/root",
      env: {
        TZ: "UTC",
      },
    },
  }),
  runtimeDriverFactory: {
    createRuntimeDriver: (runtimeOptions) =>
      new NodeExecutionDriver(runtimeOptions),
  },
  memoryLimit: memoryLimitMb,
  cpuTimeLimitMs: 10_000,
  timingMitigation: "freeze",
});

const crashingResult = await runtime.run(`
  const d = new Date(1775666102.269619 * 1000);
  export default d.toLocaleDateString("en-GB", {
    month: "short",
    day: "numeric",
    hour: "2-digit",
    minute: "2-digit",
    timeZone: "Europe/Warsaw",
  });`, 
"/root/locale-date-crash.mjs");

Plain Date usage works. The crash starts when locale-aware formatting is invoked.

Actual result

V8 runtime process killed by signal SIGTRAP

Child stderr includes a fatal OOM in ICU/V8:

Fatal process out of memory: DateTimePatternGeneratorCache::CreateGenerator

Versions

  • secure-exec: 0.2.1
  • @secure-exec/v8: 0.2.1
  • Reproduced on macOS arm64

Notes

  • This does not appear to be caused by input size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions