Act nowcan affect a running system
Client-driven services stop racing their own release
The server now keeps each sicClientDriven implementation alive until its active method returns, closing a use-after-free race with _free_, timeouts and session garbage collection. HTTP request framing, DuckDB 2.0, PDF encryption and EMF rendering also receive concrete fixes. Teams running Delphi or FPC backends should prioritize this edition when they use stateful SOA services, DuckDB 2.0 or PDF generation.
TL;DR
- sicClientDriven instances now retain an interface reference while ExecuteMethod is running, preventing concurrent release and use-after-free.
- HTTP/1.1 requests without Content-Length no longer wait for EOF when Connection: close is present; HTTP/1.0 close-delimited bodies keep their legacy handling.
- DuckDB 2.0 calls run with masked FPU exceptions, new logical types are decoded safely, and VARIANT result columns are returned as JSON text.
- FPC no longer writes into literal PDF passwords during AES-256 setup, and EMF text recorded inside a GDI path follows that path's paint operation.
- WinVerifyExeSignature, IsExeSignatureValid and TWinVerifyStatus moved from mormot.misc.pecoff to mormot.core.os.security.
Upgrade advice
Land on merged revision 50a0c6b536826827965d8f1571c4087f1b0d82a1, build 2.4.17677. Do not stop on daa87145 because cc485cc2 restores HTTP/1.0 close-delimited bodies, or on 45779260 because 027e139e adds usable VARIANT results. Upgrade promptly for sicClientDriven services, DuckDB 2.0, or FPC AES-256 PDF output. The raw payload records no later superseding fix.
10 of 10 entries · 17 commits upstream
1
High
The PDF unit compiles again after a partial merge rollback
The commit reverses 15 EMF renderer hunks accidentally reintroduced by the PDF feature-branch merge. It removes stale fInLined references and fNewPath resets, restores the null-pen and ended-path behavior from fixes #695 and #696, and restores EmfNullPenLines, EmfLineAfterEndedPath, the expected rendering hash and ScreenLogPixels := 96 in test.ui.pdf.
Fixes
mormot.ui.pdf+1
e95fbde4+181-60
ui: pdf - restore #696 and #695, lost in the merge of #690
Impact
The preceding merged PDF revision failed to compile at eleven fInLined references, so any Delphi or FPC project importing mormot.ui.pdf was blocked before runtime. This commit restores compilation and the intended EMF path behavior while keeping the AES-256 and PDF 2.0 additions from the branch.
Upgrade recommended
If your tree includes the PDF feature merge c12b33766, move past this restoration commit and rebuild every target that imports mormot.ui.pdf.
Units
2
High
DuckDB VARIANT results are reissued as JSON instead of crashing
After ExecuteStmt, TSqlDBDuckDBStatement recursively detects VARIANT in each logical type. It then rebuilds the SELECT with positional #n references and wraps affected columns in NULLIF(#n::JSON, 'null'::JSON), releases the first result, prepares the wrapper and executes it again. Positional references preserve duplicate column names, and SQL NULL remains null rather than JSON 'null'.
Fixes
mormot.db.raw.duckdb+2
027e139e+187-18
db: DuckDB 2.0 VARIANT columns are returned as JSON
Impact
SELECT statements containing top-level or nested VARIANT columns now return canonical JSON through ColumnUtf8 instead of an unsupported-type error, recursion or driver crash. A VARIANT NULL is exposed as SQL NULL. Multi-statement direct SQL still rejects VARIANT and tells the caller to cast it to JSON, so such calls need an explicit SQL cast.
Upgrade recommended
Upgrade users of DuckDB VARIANT, verify JSON and NULL handling in cached statements, and add an explicit ::JSON cast to any multi-statement direct query that exposes VARIANT.
Public API
DuckDBTypeHasVariantadded — Reports whether TDuckDBTypeInfo is VARIANT or contains a nested VARIANT.DuckDBVariantSqladded — Builds the positional wrapper SELECT used to convert selected VARIANT columns to JSON.TSqlDBDuckDBStatement VARIANT result handlingbehaviour-changed — VARIANT result columns are now exposed as JSON text, with VARIANT NULL mapped to SQL NULL.
3
High
Active sicClientDriven calls can no longer lose their instance
TServiceFactoryServer.RetrieveInstance now accepts an optional Hold: PInterface and assigns the returned implementation to it while fInstances is locked. ExecuteMethod keeps that reference for the complete method call, so InstanceFreeOrGC observes RefCount greater than one and postpones destruction until a later DoInstanceGC pass.
Fixes
mormot.soa.server
927c2f6d+18-3
soa: hold the sicClientDriven instance during ExecuteMethod
Impact
A concurrent _free_ request, instance timeout or session GC could previously release a sicClientDriven implementation while its method still used self, causing a use-after-free. The fix changes no service contract and applies to both Delphi and FPC servers; direct callers of RetrieveInstance remain source-compatible because Hold defaults to nil.
Upgrade recommended
Upgrade stateful SOA servers and stress-test long sicClientDriven methods while clients time out, send _free_, and sessions expire.
Public API
TServiceFactoryServer.RetrieveInstancesignature-changed — Adds the optional Hold: PInterface = nil parameter; existing calls remain valid.
Units
4
High
FPC AES-256 PDF setup no longer writes into literal passwords
TPdfEncryptionAes256.AttachDocument replaces FillCharFast(pointer(usr)^, ...) and the equivalent owner-password wipe with FillZero(RawByteString(...)). Under FPC, StringToUtf8 may return the caller's AnsiString literal directly; FillZero clears only a uniquely referenced writable string and skips constants.
Fixes
mormot.ui.pdf
f11fac11+3-4
ui: pdf - AES-256 on FPC: no wipe of a constant password
Impact
Every tested FPC target previously raised an access violation when EncryptionAes256 or Pdf20File received literal passwords such as 'owner'; Delphi passed. FPC PDF producers can now use AES-256 and PDF 2.0 with constant passwords without writing into read-only memory. The change does not alter the encrypted document format.
Upgrade recommended
Upgrade FPC PDF producers using AES-256 or Pdf20File and rerun encryption tests with literal, shared and dynamically built user and owner passwords.
Units
5
High
DuckDB 2.0 no longer trips FPC exceptions or recursive decoding
The DuckDB wrappers surround open, query, prepare, execute, result fetching and Appender EndRow, Flush and Close with SetFpuFlags and ResetFpuFlags because DuckDB worker threads inherit the caller's FPU mask. The type map adds TIMESTAMPTZ_NS as ftDate and GEOMETRY as ftBlob/WKB. Unknown logical types now raise ESqlDBDuckDB instead of bouncing between DuckDBVectorValueToText and DuckDBVectorValueToJson until stack overflow.
Compiler & platform
mormot.db.raw.duckdb+2
45779260+126-29
db: DuckDB 2.0 support - masked FPU exceptions and new column types
Impact
FPC configurations with the default unmasked exceptions no longer raise EInvalidOp merely by opening or using DuckDB 2.0. TIMESTAMPTZ_NS and GEOMETRY columns become readable with their expected mORMot field types, and unsupported types fail explicitly instead of crashing through stack exhaustion. Delphi also receives the new type mappings, while existing supported types keep their behavior.
Upgrade recommended
Upgrade DuckDB 2.0 backends and run open, prepare, execute, fetch and Appender tests under the same Delphi or FPC FPU settings used in production.
Public API
DUCKDB_TYPE_GEOMETRY, DUCKDB_TYPE_VARIANT, DUCKDB_TYPE_TIMESTAMP_TZ_NSadded — Adds the DuckDB 2.0 logical type identifiers 40, 41 and 42 to mormot.db.raw.duckdb.
6
Medium
Windows Authenticode verification moves to the OS security unit
TWinVerifyStatus, WinVerifyExeSignature and IsExeSignatureValid move unchanged from the Windows section of mormot.misc.pecoff to mormot.core.os.security, together with the WinVerifyTrust records, constants and implementation. mormot.misc.pecoff keeps the cross-platform GetExeSignature and IsExeSigned PE parsing functions and removes its FPC PACKRECORDS workaround.
Breaking changes
mormot.core.os.security+1
9f798fe6+188-193
os: moved WinVerifyExeSignature() to mormot.core.os.security
Impact
Windows code that imported only mormot.misc.pecoff to call the verification functions will no longer compile until mormot.core.os.security is added to uses. Function signatures and runtime verification behavior are unchanged. Code using GetExeSignature or IsExeSigned remains on mormot.misc.pecoff, and non-Windows builds do not gain the Windows-only API.
Migration required
Search for TWinVerifyStatus, WinVerifyExeSignature and IsExeSignatureValid. Add mormot.core.os.security to the uses clause of each Windows unit that references them; keep mormot.misc.pecoff when GetExeSignature or IsExeSigned is also used.
Public API
mormot.misc.pecoff.TWinVerifyStatus/WinVerifyExeSignature/IsExeSignatureValidremoved — The Windows-only verification type and functions are no longer declared by mormot.misc.pecoff.mormot.core.os.security.TWinVerifyStatus/WinVerifyExeSignature/IsExeSignatureValidadded — The same Windows-only public declarations now live in mormot.core.os.security.
7
Medium
EMF text inside a GDI path now follows the path paint operation
TPdfEnum records EMR_EXTTEXTOUTA/W encountered between BeginPath and EndPath in a separate fPathText stream. FillPath, StrokePath and StrokeAndFillPath replay that text afterward with PDF text render modes 0, 1 or 2 and the selected brush or pen; AbortPath drops it. PathTextOut also adds opaque backgrounds, ETO_OPAQUE rectangles, underline and strike-out geometry to the path while ETO_CLIPPED contributes no text.
Fixes
mormot.ui.pdf+1
fb61df56+359-7
ui: pdf - EMF text in a GDI path is painted with the path
Impact
Converted EMF previously drew path text immediately in the text color: aborted paths still showed it, StrokePath filled it, and FillPath ignored the brush color. Generated PDFs now follow observed Windows GDI behavior for those cases. The change affects document appearance only when EMF text is recorded inside a GDI path; normal PDF text remains unchanged on Delphi and FPC.
Upgrade recommended
Regenerate representative PDFs containing EMF text in FillPath, StrokePath, StrokeAndFillPath and AbortPath, then compare the output with Windows GDI rendering.
Units
8
Medium
HTTP/1.1 avoids the close-body timeout without breaking HTTP/1.0
GetRequest now sets a missing Content-Length to zero for keep-alive requests, HTTP/1.1 requests, and GET. An HTTP/1.0 non-GET request using connection close keeps ContentLength negative so the existing read-until-close path can receive its body.
Fixes
mormot.net.server
cc485cc2+4-1
net: keep the read-until-close body for HTTP/1.0 requests only
Impact
Python urllib and similar HTTP/1.1 clients can send empty POST or DELETE requests with Connection: close without stalling the mORMot server until timeout. Legacy HTTP/1.0 clients that delimit a non-GET body by closing the socket continue to work. No application API changes are required on Delphi or FPC.
Upgrade recommended
Upgrade HTTP servers that accept empty POST or DELETE requests, then test both HTTP/1.1 Connection: close and an HTTP/1.0 close-delimited request body.
Public API
THttpServerSocket.GetRequestbehaviour-changed — Missing length means an empty body for HTTP/1.1, while HTTP/1.0 non-GET may still read until close.
Units
9
Medium
Missing request length is first treated as an empty body
THttpServerSocket.GetRequest changes any negative Http.ContentLength to zero after parsing the headers. This prevents DELETE or empty POST requests sent with Connection: close and no Content-Length from entering the read-until-EOF path and waiting until the socket timeout.
Fixes
mormot.net.server
daa87145+1-3
net: request without Content-Length has an empty body, also with Connection: close
Impact
The change removes the observed HTTP/1.1 hang, but on this intermediate revision it also suppresses valid HTTP/1.0 non-GET bodies delimited by connection close. The next commit in the edition corrects that scope, so production servers should not stop on this SHA.
Public API
THttpServerSocket.GetRequestbehaviour-changed — A request without Content-Length is initially treated as bodyless regardless of Connection: close.
Units
10
Low
The service-instance hold avoids a per-call compiler finalizer
ExecuteMethod replaces the local managed IInterface variable with a pointer that owns the same interface reference. HandleCleanup releases it in its existing finally block, and the two early exits clear it explicitly. This preserves the lifetime fix while avoiding an extra compiler-generated try..finally on every service call.
Performance
mormot.soa.server
dc3195e9+8-2
soa: release the hold reference manually in ExecuteMethod
Impact
Service behavior and the public signature are unchanged from the preceding fix. Delphi and FPC backends keep the protection against concurrent release with less managed-variable overhead in the hot ExecuteMethod path; no application change is required.