mORMot2 DailyDaily read of upstream commits

Windows parent lookups stop leaking handles while JOP parsing hardens

GetParentProcess now closes its Windows process snapshot even when it finds the requested PID, preventing one handle from leaking per successful lookup. Five JOP fixes stop malformed conditionals, nested fallbacks and quoted template values from reading past their input or being parsed incorrectly. A low-level URL decoder is also exposed from mormot.core.buffers without changing its implementation.

TL;DR

  • Repeated GetParentProcess calls on Windows no longer leak Toolhelp snapshot handles.
  • Malformed JOP conditionals, nested fallbacks and unterminated strings now stop safely at the input boundary.
  • Quoted JOP values preserve #, //, } and ] characters instead of treating them as syntax.
  • DoUrlDecode is now public in mormot.core.buffers with its existing low-level signature.

Upgrade advice

Land on build 2.4.18076. Windows services that call GetParentProcess repeatedly should take the handle-leak fix, and applications using TextPreprocess or JsonPreprocess should take the complete JOP sequence through build 18075 rather than stopping on an intermediate parser fix.

Build2.4.18067 → 2.4.18076
Commits9
Lines+135 -59
Read3 min

7 of 7 entries · 9 commits upstream

Stories
# Entry Category Units
1 High A missing JOP $endif$ no longer walks beyond the input TPreproc.DoSkip in mormot.core.fmt now checks the result of PosChar before passing it to ParseIfDollar. When no later '$' exists, it points P at NULCHAR and stops. A regression test confirms that an unterminated false $if block returns the preceding text instead of raising an access violation. Fixes mormot.core.fmt be898be4+45-31

core: fixed missing $endif$ in JOP

Impact

Delphi and FPC applications that preprocess malformed JOP or text templates no longer risk an access violation solely because $endif$ is missing. Valid conditional output remains covered and unchanged.

Public API

  • TextPreprocessbehaviour-changed — An unterminated skipped conditional now stops at end of input instead of dereferencing a nil scan result.

Arnaud Bouchez · 11:16 UTC · view the commit on GitHub →

2 High Unterminated nested JOP fallbacks stop at the closing boundary TPreproc.Expand in mormot.core.fmt now advances across visible fallback text while searching for the expected ')' or '}' and increments the pointer only when that delimiter is present. Tests cover both a valid nested fallback and a missing outer parenthesis. Fixes mormot.core.fmt 26e29548+13-4

core: fixed unterminated nested JOP fallback can read past the input

Impact

A malformed nested fallback passed to TextPreprocess no longer advances beyond its terminating #0. Valid cascaded defaults keep resolving to the inner value on Delphi and FPC.

Arnaud Bouchez · 11:20 UTC · view the commit on GitHub →

3 High Unterminated quoted JOP templates stop at #0 GotoTemplateEnding in mormot.core.fmt now checks for #0 immediately after GotoEndOfJsonString or GotoEndOfQuotedString returns. It exits before the unconditional pointer increment. Regression tests cover unterminated double-quoted and single-quoted object values. Fixes mormot.core.fmt 664175e6+13-2

core: fixed unterminated strings inside a JOP template

Impact

Malformed template objects with an open quote return an empty preprocessing result instead of reading beyond the string terminator. The fix applies to Delphi and FPC code using the JOP preprocessor.

Arnaud Bouchez · 12:20 UTC · view the commit on GitHub →

4 High Windows parent-process lookups release their snapshot handle RawProcessInfo in mormot.core.os.windows no longer exits from inside its Process32FirstW and Process32NextW loop. It records whether the PID matched, leaves the loop, and always calls CloseHandle on the Toolhelp snapshot. The Windows test calls GetParentProcess 30 times and checks that the process handle count stays bounded. Fixes mormot.core.os+1 15ea61a1+8-5

core: fixed GetParentProcess handle leak on Windows

Impact

A long-running Delphi or FPC Windows backend that repeatedly calls GetParentProcess no longer loses one kernel handle per successful lookup. Return values and the public signature are unchanged; non-Windows backends are unaffected.

Public API

  • GetParentProcessbehaviour-changed — Successful Windows lookups now close their Toolhelp snapshot before returning.

zen010101 · 06:15 UTC · view the commit on GitHub →

5 Medium Quoted JOP values keep hash and slash markers TPreproc.DoRegister now recognizes # and // as comment starters only for pmTemplate values. Quoted or escaped JOP values keep those characters, including markers that follow an expanded variable. Three tests cover #, // and a variable followed by #tag. Fixes mormot.core.fmt d20b42b4+24-3

core: fixed # and // inside quoted JOP DSL values treated as comments

Impact

JOP string values such as labels, fragments and URLs no longer lose text after # or // merely because a space precedes the marker. Template-level comments continue to work.

Arnaud Bouchez · 11:23 UTC · view the commit on GitHub →

6 Medium Single-quoted JOP strings may contain closing braces GotoTemplateEnding in mormot.core.fmt now sends a single quote to GotoEndOfQuotedString, just as double quotes already use GotoEndOfJsonString. Braces and brackets inside a single-quoted value therefore no longer change the template nesting level. A regression object contains 'a}b'. Fixes mormot.core.fmt ad6c876a+11-2

core: fixed } or ] inside single-quoted template strings

Impact

JOP object and array templates containing } or ] inside single-quoted text are no longer cut short or structurally misread. Existing Delphi and FPC source code needs no migration.

Arnaud Bouchez · 11:27 UTC · view the commit on GitHub →

7 Low The low-level URL decoder becomes callable by applications mormot.core.buffers adds the existing DoUrlDecode(P, U: PByte; replace: AnsiChar): PUtf8Char declaration to its interface. The implementation at the end of the unit is unchanged; this commit only publishes the low-level routine used by the higher-level UrlDecode functions. New features mormot.core.buffers 01ca62ea+5-2

core: published DoUrlDecode() internal function

Impact

Delphi and FPC code can now call DoUrlDecode directly when it already manages mutable byte buffers and replacement rules. Existing callers of UrlDecode functions see no behavior change, and the pointer-level API requires the caller to provide valid buffer bounds.

Public API

  • DoUrlDecodeadded — The existing internal decoder is now declared in the unit interface with its pointer-level signature.

Arnaud Bouchez · 20:46 UTC · view the commit on GitHub →

Upstream activity commits per day · last 60 days
Commits1007
Active days49/60
Busiest2026-09-30
Peak60
2026-09-30: 60 commits2026-10-01: 26 commits2026-10-02: 30 commits2026-10-03: 32 commits2026-10-04: 15 commits2026-10-05: 1 commit2026-10-06: 26 commits2026-10-07: 37 commits2026-10-08: 27 commits2026-10-09: 35 commits2026-10-10: 12 commits2026-10-11: 2 commits2026-10-12: 40 commits2026-10-13: 31 commits2026-10-14: 23 commits2026-10-15: 16 commits2026-10-16: 27 commits2026-10-17: 0 commits2026-10-18: 0 commits2026-10-19: 0 commits2026-10-20: 0 commits2026-10-21: 0 commits2026-10-22: 3 commits2026-10-23: 6 commits2026-10-24: 29 commits2026-10-25: 7 commits2026-10-26: 25 commits2026-10-27: 4 commits2026-10-28: 8 commits2026-10-29: 17 commits2026-10-30: 20 commits2026-10-31: 0 commits2026-11-01: 0 commits2026-11-02: 16 commits2026-11-03: 32 commits2026-11-04: 15 commits2026-11-05: 32 commits2026-11-06: 26 commits2026-11-07: 19 commits2026-11-08: 2 commits2026-11-09: 29 commits2026-11-10: 17 commits2026-11-11: 8 commits2026-11-12: 38 commits2026-11-13: 39 commits2026-11-14: 9 commits2026-11-15: 6 commits2026-11-16: 21 commits2026-11-17: 30 commits2026-11-18: 37 commits2026-11-19: 28 commits2026-11-20: 31 commits2026-11-21: 0 commits2026-11-22: 0 commits2026-11-23: 1 commit2026-11-24: 6 commits2026-11-25: 3 commits2026-11-26: 3 commits2026-11-27: 0 commits2026-11-28: 0 commits
2026-09-302026-11-28