Skip to content

v0.23.0 — hardening: hang/DoS fixes, options that throw, hostile-file guards

Choose a tag to compare

@sobechestnut-dev sobechestnut-dev released this 12 Nov 17:44
9973d86

All fourteen @chestnutlabs/* packages release in lockstep at v0.23.0 (npm, provenance).

This is a hardening release. It comes from mutation-testing sweeps of the parser, containers, renderers and model viewer. Ordinary files render as before. Options that have no meaning now throw, and hostile files can no longer hang or distort the viewer.

Hang and DoS fixes

  • A G2/G3 arc whose points lie beyond the float32 range no longer hangs the parser. Dropped segments count toward maxSegments (#526).
  • Replacing the source several times in one tick applies only the newest file. Superseded calls resolve { ok: false, cancelled: true } (#531). setScrubTime no longer draws one segment too many.
  • A file or quality change during a large tube build no longer shows the previous file's tubes. The geometry pool pairs each reply with its own request (#537).
  • Hostile RS274NGC programs (long elseif chains, long conditions, many call arguments inside loops) can no longer keep the parser busy for hours. maxProgramIterations now counts that work (#540).

Behaviour changes: options that now throw

  • Parse limits must be non-negative integers. Anything else throws ParseOptionError with E_PARSE_OPTION, and Infinity is no longer "unlimited" (#521).
  • Model limits throw ModelParseError with E_MODEL_OPTION. maxObjects is now enforced (E_MODEL_TOO_MANY_OBJECTS). Every 3MF assembly node counts against maxInstances, and a self-containing object throws E_MODEL_CYCLE (#527).
  • Colour modes: an explicit range must be finite, >= 0 and ascending, and only must be a 1-based integer. Otherwise there's a RangeError before anything is stored. The new checkColorMode is exported from gcode-colors and gcode-renderer-2d (#539).
  • Tube and budget options (tube.*, tubeByteBudget, geometryMemoryBudgetBytes, geometryConcurrency) and qualityMode / setQualityMode ('full' | 'adaptive' | 'fast') throw RangeError (#537). So do build-volume sizes and decimation (#519), and ToolpathIRBuilder channels outside their typed-array range (#533).

Behaviour changes: file data

  • Impossible numbers in slicer comments, .bgcode and .gcode.3mf settings and thumbnail headers are left out, with a warning, never thrown on. The warnings are dialect-metadata-invalid, bgcode-metadata-invalid, bgcode-bed-unparsed and container-metadata-invalid. No more Infinity beds or NaN print times (#536, #538).
  • 3MF and STL files with non-finite geometry fail with E_MODEL_PARSE (#528). .bgcode with more than 1,000,000 blocks throws E_BGCODE_BOMB, and a cut MeatPack stream throws E_BGCODE_MEATPACK (#536).
  • A G2/G3 arc with a negative E is travel, not extrusion. An arc that omits I/J is drawn as an arc, and one with no centre at all warns arc-missing-center (#521, #524).
  • filament colour mode draws a tool or swap the file gave no colour for in fallback, instead of borrowing another filament's colour (#539).
  • RS274NGC ROUND rounds halves away from zero, as LinuxCNC does (ROUND[-2.5] = -3). A write to a read-only parameter warns rs274-readonly-param (#540).

New

  • renderStill takes qualityMode (#530).
  • Segments skipped for a non-finite coordinate are disclosed in 2D and 3D, and 2D now fires build-complete (#523).
  • BgcodeDecodeResult.droppedThumbnails (#536).

Real-file check

All 47 test-data files went through the full worker pipeline at v0.22.0 and v0.23.0:

  • 43 are byte-identical, and no file's metadata changed.
  • 3DBenchy gains 3 segments (arcs that omitted an offset).
  • plant-sign and screw change only their move kind (retract arcs become travel).