Act nowcan affect a running systemThe raw payload contains 38 commits, of which 30 are non-merge commits reviewed here. Build numbers were read only from the mormot.commit.inc diffs; branch commits without that bookkeeping are not assigned invented builds.
TOTP validation changes contract amid database and lifecycle fixes
TotpValidate now requires callers that pass optional arguments to supply the digit count explicitly, and can return the matching time step. OleDB, ODBC and PostgreSQL receive correctness fixes, while network shutdown, proxy downloads and external processes close several crash, hang and race paths. Delphi and FPC backends are affected where their platform-specific drivers or process code are used.
TL;DR
- Calls to TotpValidate with optional positional arguments must be updated for the inserted digits parameter.
- OleDB ID-list rowsets need the complete sequence through build 18025 to avoid dangling BSTR values, broken rewind and invalid row handles.
- ODBC string buffers are corrected again in build 18011; do not stop on builds 18009 or 18010.
- Async shutdown, proxy downloads and TExternalProcess now close race, double-free and no-reader failure paths.
Upgrade advice
Land on build 2.4.18026, but first update every TotpValidate call that supplies optional positional arguments: digits now precedes window, and timematch precedes binary. Avoid builds 18009–18010 for ODBC string parameters and builds 18021–18024 for OleDB ID-list rowsets. The raw payload contains no superseded_by records, so no later stability claim is made.
30 of 30 entries · 38 commits upstream
1
High
TOTP validation now takes an explicit digit count
mormot.crypt.secure inserts digits before window in TotpValidate, adds timematch before binary, and changes timestep to TUnixTime. Validation rejects a code whose length differs from digits and reports the matched step through PUnixTime.
Breaking changes
mormot.crypt.secure
be7dfa2b+45-21
crypt: enhanced TotpValidate()
Impact
Two-argument calls keep the six-digit default. Existing Delphi or FPC calls that pass window, algo, timestep or binary positionally can compile with shifted meanings or fail, potentially rejecting valid authentication codes.
Migration required
Search for TotpValidate calls with more than two arguments and insert the intended digits value before window; pass nil or a PUnixTime before binary.
Public API
TotpValidatesignature-changed — Adds digits and timematch parameters and uses TUnixTime for timestep.TotpGeneratesignature-changed — The timestep type changes from Int64 to TUnixTime.
Units
2
High
OleDB string rows stop exposing temporary BSTR pointers
TIDListRowset binds DBTYPE_BSTR as a pointer-sized client-owned value, transfers the WideString allocation deliberately, resets null rows and computes record offsets from a pointer.
Fixes
mormot.db.raw.oledb
a756d8a0+27-23
db: fixed OleDB TIDListRowset implementation
Impact
This removes dangling BSTR values that could cause random access violations in Delphi Windows OleDB array parameters. Later commits complete rewind and handle checks.
Worth a look
Take the whole TIDListRowset sequence through build 18025, not this intermediate build alone.
Units
3
High
Process startup cleans up when its reader thread cannot start
TExternalProcess.StartThread returns boolean and catches thread creation failure, kills the child, closes handles, resets fThreaded and sets epsFailed; both Start overloads return false.
Fixes
mormot.core.os
b2eaa6f6+20-10
core: TExternalProcess.Start returns false if its thread could not be created
Impact
Resource exhaustion no longer leaves a child running without an output reader and no longer makes Destroy wait forever. The behavior is tested on FPC Linux and Delphi/FPC Win64/Linux64.
Upgrade recommended
Upgrade users of TExternalProcess and handle a false Start result as a complete failed launch.
Public API
TExternalProcess.Startbehaviour-changed — Returns false and cleans up when its background thread cannot be created.
Units
4
High
Async shutdown waits for every worker before release
TAsyncConnections.Shutdown explicitly calls WaitFor on every fThreads worker before ObjArrayClear releases the thread instances.
Fixes
mormot.net.async
dc568099+5-3
net: fixed potential race in TAsyncConnections.Shutdown
Impact
Servers no longer rely on object destruction alone to join workers, closing a race where asynchronous work could overlap resource release in Delphi or FPC.
Upgrade recommended
Upgrade asynchronous servers that start and stop TAsyncConnections during service shutdown or tests.
Units
5
High
OpenAPI boolean defaults no longer index outside their table
TPascalType.ToDefaultParameterValue converts VBoolean to a normalized boolean index before selecting BOOL_UTF8, instead of using the raw VariantBool value.
Fixes
mormot.net.openapi
51d84d03+3-3
net: avoid potential buffer overflow in TPascalType.ToDefaultParameterValue
Impact
A true VariantBool commonly uses -1; using it as an array index could access memory before BOOL_UTF8 while generating Pascal defaults from OpenAPI metadata.
Upgrade recommended
Upgrade OpenAPI code generators that process boolean default parameters.
Units
6
High
Throttled proxy downloads release their file stream once
THttpProxyUrl.BackgroundGet frees TStreamRedirect alone when it wraps the file stream, because its destructor owns that stream; otherwise it frees the file stream directly.
Fixes
mormot.net.async
083ff5c5+3-2
net: fixed double release of the file stream in THttpProxyUrl.BackgroundGet
Impact
When HttpLimitPerSecond is set, completed or failed background downloads no longer double-free the same file stream, preventing heap corruption or access violations.
Upgrade recommended
Upgrade deployments using THttpProxyUrl with bandwidth limiting.
Units
7
Medium
Streamed PDFs keep header and cross-reference versions consistent
TPdfDocument stores fHeaderFileFormat at SaveToStreamDirectBegin, chooses the final cross-reference from that header, and NeedFileFormat writes a later required version into the catalog without lowering it.
Fixes
mormot.ui.pdf
29551210+87-6
ui: pdf - a version needed after the header is written goes to the catalog
Impact
PDFs that enable print scaling or PDF 1.5 after streaming begins no longer combine a low-version header with an incompatible cross-reference stream.
Upgrade recommended
Upgrade code that changes ViewerPreference or GeneratePdf15File after SaveToStreamDirectBegin.
Units
8
Medium
VariantSaveJson normalizes booleans and date values
mormot.core.variants handles varBoolean directly and serializes varDate through DateTimeToIso8601Var, producing JSON null for zero, quoted ISO-8601 for JSON escaping and unquoted text for twNone.
Fixes
mormot.core.variants
aff9a0e1+73-5
core: fixed VariantSaveJson()
Impact
Serialized Variant booleans and TDateTime values now have stable JSON forms. Applications comparing the former textual output should review snapshots and wire expectations.
Worth a look
Retest code that calls VariantSaveJson for varBoolean or varDate and compares exact text.
Public API
VariantSaveJsonbehaviour-changed — Normalizes booleans and emits ISO-8601 for varDate.
Units
9
Medium
OleDB rewind reads the requested row again
TIDListRowset.FillRowData now receives HROW and indexes farr from that handle instead of the forward-only fidxRow cursor.
Fixes
mormot.db.raw.oledb
1c96c089+15-16
db: fixed TIDListRowset.GetData OleDB rewind support
Impact
OleDB consumers can revisit an earlier row without receiving data from the current cursor position. This is an intermediate repair followed by row-handle validation.
Units
10
Medium
REST connection failures preserve the real exception
TRestClientUri.IsOpen records HTTP_CLIENTERROR, the exception object and debug JSON before OnConnectionFailed, clears them after success, and Uri avoids overwriting that message with a generic status.
Fixes
mormot.rest.client
75fea00a+17-9
rest: fixed TRestClientUri.IsOpen error handling
Impact
Delphi and FPC REST clients expose the actual connection exception through LastError fields instead of losing it, improving diagnostics and retry decisions.
Upgrade recommended
Upgrade services that inspect LastErrorMessage or OnConnectionFailed after transport failures.
Units
11
Medium
Windows process jobs retain and terminate child processes
The TExternalProcess Windows backend creates the roWinJobCloseChildren job with allowSilentBreakaway=false and adds a regression test with a child ping process.
Fixes
mormot.core.os+1
aeb9645a+21-1
core: TExternalProcess roWinJobCloseChildren also closes the children
Impact
Terminate, Kill, destruction and parent exit now include descendants for this option under Delphi and FPC Win64. RunCommandWin behavior is unchanged.
Upgrade recommended
Upgrade Windows services that rely on roWinJobCloseChildren to prevent orphaned grandchildren.
12
Medium
OleDB ID rowsets reject invalid row handles
mormot.db.raw.oledb makes TIDListRowset.GetData return DB_E_BADROWHANDLE when HROW is zero or beyond farr, and fills valid rows directly.
Fixes
mormot.db.raw.oledb
4d8d2071+10-7
db: hardened TIDListRowset.GetData against wrong OleDB usage
Impact
Malformed OleDB consumer calls no longer index outside the row array. Delphi Windows applications using ID-list table-valued parameters should take this final rowset hardening.
Upgrade recommended
Take build 18025 or later rather than either preceding TIDListRowset revision.
Units
13
Medium
ODBC metadata and parameter lengths are counted in bytes
TOdbcLib.GetInfoString passes the byte size expected by GetInfoW and converts the returned byte count to WideChar units; ExecutePrepared adjusts its string buffer accounting.
Fixes
mormot.db.raw.odbc+1
01582ed1+7-9
db: some other buffer length fixes to ODBC driver
Impact
Unicode ODBC metadata is no longer truncated by passing half the available buffer. The parameter-size part is refined again by build 18011.
14
Medium
PostgreSQL connection state checks libpq status
TSqlDBPostgresConnection.IsConnected now requires both a non-nil fPGConn and PQ.Status(fPGConn)=CONNECTION_OK instead of testing only the pointer.
Fixes
mormot.db.sql.postgres
2ed24df7+8-6
db: fixed TSqlDBPostgresConnection.IsConnected
Impact
A broken libpq connection is reported as disconnected to Delphi and FPC callers even while the handle still exists, enabling existing recovery paths.
Upgrade recommended
Upgrade PostgreSQL services that use IsConnected to decide whether to reconnect.
15
Medium
ODBC string parameter terminators use their real width
TSqlDBOdbcStatement.ExecutePrepared adds one byte for SQL_C_CHAR and two bytes for SQL_C_WCHAR instead of the intermediate four-byte increment.
Fixes
mormot.db.sql.odbc
e5e90048+8-5
db: hardened TSqlDBOdbcStatement.ExecutePrepared fix on WCHAR
Impact
ODBC drivers receive the correct byte length for terminated narrow and UTF-16 parameters, avoiding reads beyond the actual encoded string buffer.
Upgrade recommended
Use build 18011 or later for ODBC string parameters; avoid the intermediate 18009 and 18010 builds.
Units
16
Medium
Failed PostgreSQL prepares no longer poison the cache
TSqlDBPostgresConnection.PrepareCached derives the statement name from fPrepared.Count, calls PQ.Prepare, and adds SQL to fPrepared only after PQ.Check succeeds.
Fixes
mormot.db.sql.postgres
78ba5286+5-4
db: fixed TSqlDBPostgresConnection.PrepareCached on error
Impact
A failed prepare can be retried instead of being recorded as cached when PostgreSQL never accepted it. Existing successful prepares keep their naming sequence.
Upgrade recommended
Upgrade PostgreSQL backends that recover from statement preparation errors without reconnecting.
17
Medium
BSON date decoding excludes the closing quote
TBsonVariant.TryJsonToVariant passes L - 1 rather than L to Iso8601ToDateTimePUtf8CharVar, so the closing quote is no longer included in the date span.
Fixes
mormot.db.nosql.bson
9226b8d9+3-3
db: fixed TryDate() BSON decoding
Impact
BSON extended JSON dates that previously failed TryDate can decode again in both Delphi and FPC applications.
Upgrade recommended
Upgrade if BSON extended JSON date values are parsed through TBsonVariant.
Units
18
Medium
Contended interface execution applies options to the right writer
TInterfaceMethodExecuteCached.Acquire assigns WROptions to result.fWR, so a transient executor created under contention receives the requested writer options instead of modifying the shared cached writer.
Fixes
mormot.core.interfaces
e9c7377a+3-3
core: fixed TInterfaceMethodExecuteCached.Acquire
Impact
Concurrent Delphi or FPC interface calls no longer apply serialization options to the wrong executor, preventing request-specific writer settings from being lost or leaked.
Upgrade recommended
Upgrade services with concurrent interface-based execution and non-default writer options.
19
Medium
Linux process names come from the executable link
EnumProcessName passes @fn[1] rather than the ShortString length byte to fpReadLink for /proc/<pid>/exe and tests that the current process yields an absolute path.
Fixes
mormot.core.os.posix
52600cfd+4-2
core: EnumProcessName reads the /proc/<pid>/exe link on Linux
Impact
Linux Delphi/FPC callers now receive the executable path when permitted instead of falling back to argv[0], which may be relative or altered.
Upgrade recommended
Upgrade Linux code that uses EnumProcessName for identity, diagnostics or supervision.
Units
20
Medium
Failed proc reads return an empty terminated buffer
LoadProcFile initializes dest[0] to #0 before opening the file, so EnumProcessName, FindFileValue and FindFileCardinal cannot inspect stale stack bytes on open failure.
Fixes
mormot.core.os.posix
9024a67e+6-0
core: LoadProcFile always returns a #0 terminated buffer
Impact
Unknown or exited Linux PIDs now produce an empty result rather than nondeterministic text in Delphi and FPC process inspection.
Upgrade recommended
Upgrade Linux services that inspect disappearing processes through these proc helpers.
Units
21
Medium
ISO-8601 parsers accept hour and minute precision
mormot.core.datetime adds _Iso8601DecodeTime and routes date-time and time-only decoding through it, accepting HH and HH:MM forms while rejecting hours above 23 and minutes or seconds above 59.
New features
mormot.core.datetime
a58f88a6+176-136
core: allow ISO-8601 HH:MM and HH decoding
Impact
Existing Delphi and FPC parsers accept more valid reduced-precision input and reject out-of-range values consistently. Strict JSON/BSON paths retain their full-format contract.
Worth a look
Retest integrations that previously rejected reduced ISO-8601 times or relied on permissive out-of-range parsing.
Public API
Iso8601ToDateTime/Iso8601ToTime/Iso8601ToTimeLogbehaviour-changed — Accept reduced HH and HH:MM precision and enforce ranges.
Units
22
Medium
ODBC connections use the Unicode entry points
TSqlDBOdbcConnection.Connect converts DSN, credentials and full connection strings to UTF-16, calls ConnectW or SqlDriverConnectW, checks output truncation and converts the returned string back to UTF-8.
Compiler & platform
mormot.db.raw.odbc+1
236ce73b+29-17
db: fixed TSqlDBOdbcConnection.Connect to trigger UTF-16
Impact
Providers such as MariaDB are forced onto their Unicode mode, preventing returned data from remaining ANSI encoded. Windows Delphi/FPC deployments should verify driver-specific connection strings.
Worth a look
Test DSN and full connection-string paths with the production ODBC driver, then take the later buffer fixes too.
23
Low
Date conversion can omit an empty date or time half
DateTimeToIso8601Var and the buffer overload of DateTimeToIso8601 add AlwaysDateAndTime, defaulting to true; false omits the date when trunc(D)=0 or time when frac(D)=0.
New features
mormot.core.datetime
30b88139+14-9
core: optional AlwaysDateAndTime parameter to Date/Time conversion functions
Impact
Existing calls keep their output because the new parameter defaults to true. New callers can request date-only or time-only text without post-processing.
Public API
DateTimeToIso8601Varsignature-changed — Adds optional AlwaysDateAndTime=true.DateTimeToIso8601(PUtf8Char,...)signature-changed — Adds optional AlwaysDateAndTime=true.
Units
24
Low
JSON null checks share one constant-time helper
mormot.core.json publishes IsNullJson and the core, Mustache, MongoDB and SQL adapters replace repeated string comparisons or assignments with NULL_STR_VAR and IsNullJson.
Under the hood
mormot.core.json+8
a662be4e+62-58
core: huge refactoring of 'null' constant usage
Impact
No intended application behavior changes. Delphi and FPC code gains a public helper for exact lowercase JSON null stored as RawUtf8.
Public API
IsNullJsonadded — Tests for exact lowercase null in a RawUtf8.
25
Low
JSON date quoting moves into the date writer
TJsonSaveContext.AddDateTime passes the quote character directly to TTextDateWriter.AddDateTime and removes separate quote writes.
Under the hood
mormot.core.json
e56e2ed6+4-7
core: simplified TJsonSaveContext.AddDateTime
Impact
No public API change and no intended output change for Delphi or FPC backends; this consolidates the serialization path.
Units
26
Low
HTTP proxy behavior receives end-to-end regression coverage
test.net.proto adds a local origin and exercises THttpProxyServer folder, remote URI and callback sources, including caching, ranges, validators, unsafe paths, concurrent download sharing and restart.
Tests
0309bbc0+329-0
tests: THttpProxyServer end-to-end regression tests - see #392
Impact
No production API changes. The tests protect existing proxy semantics and the adjacent stream-ownership fix across Delphi/FPC test runs.
27
Low
Process tests tolerate IDE, XP and Wine limitations
mormot.core.os.windows changes AppendArg to TRunArg and clarifies command ownership; tests skip signal stress under a debugger, avoid findstr under Wine and run RunRedirect through the slow-test harness.
Tests
mormot.core.os.windows
587894c7+82-86
test: fixed IDE, XP and Wine context support
Impact
No production behavior change is intended. CI and local test runs become less dependent on debugger, legacy Windows and Wine behavior.
28
Low
Reduced ISO-8601 forms gain boundary coverage
test.core.base adds reduced date-time, time-only, midnight, range, offset, strict JSON and BSON cases; test.core.data tightens related assertions.
Tests
21e86cb5+113-6
test: completed ISO-8601 coverage
Impact
No application code changes. The tests document the accepted parser boundary and protect the preceding ISO-8601 implementation.
29
Low
Late PDF 1.5 selection is documented precisely
mormot.ui.pdf documents that GeneratePdf15File set after SaveToStreamDirectBegin no longer changes the cross-reference format, and shortens the matching test comment.
Docs
mormot.ui.pdf
98555531+4-5
ui: pdf - GeneratePdf15File documented for a late change, a shorter test comment
Impact
No application code changes. The public property documentation now matches the preceding PDF serialization fix.
Units
30
Low
Termination documentation defines Windows and output limits
The TExternalProcess.Terminate comment explains when Windows can send CTRL_BREAK or WM_QUIT, when a GUI parent must hard-kill, and that WaitFor is needed to consume final output.
Docs
mormot.core.os
7a479e07+8-0
core: more TExternalProcess.Terminate documentation - see #648
Impact
No code changes. Delphi and FPC callers receive clearer guidance for graceful Windows termination and output draining.