mORMot2 DailyDaily read of upstream commits

Numeric parsing is hardened and DHCP setup loses a dangling pointer

Numeric conversion now rejects malformed decimals, exponent overflow and values outside signed or Currency bounds instead of wrapping or accepting invalid JSON. TDhcpProcess.Setup no longer keeps a pointer across a scope-array mutation that could cause a GPF or deadlock. Date and time conversion gains several integer-based APIs, original Keccak-256 and Microsoft TimeSpan support arrive, and one ToNcsaShort signature change requires source review.

TL;DR

  • Take the final head on build 2.4.16828: the numeric correctness fix was merged on top without another build-number increment.
  • GetInteger, GetExtended and GetNumericVariantFromJson now reject overflow and malformed decimal or exponent syntax instead of returning wrapped or ambiguous values.
  • TDhcpProcess.Setup copies each scope before PrepareScope can mutate the backing array, removing a documented GPF or deadlock path.
  • Callers passing a generic ShortString to TSynSystemTime.ToNcsaShort must switch that var argument to TShort23 or use a TShort23 local.
  • The date/time layer adds integer Gregorian, Unix millisecond, Julian-day, HTTP-date and Microsoft TimeSpan helpers, while LDAP can decode atsTimeSpan.
  • mormot.crypt.core now supports the original Keccak-256 padding used by protocols such as Ethereum, distinct from SHA3-256.

Upgrade advice

Production users that parse untrusted numeric JSON or reconfigure DHCP scopes should take the final revision at head 692bbbf21960be5fdf89921673a34f928fadddfc, which still reports build 2.4.16828. Search for ToNcsaShort calls: any var output declared as generic ShortString must become TShort23 or be bridged through a TShort23 local. No superseded_by data marks an intermediate build to avoid.

Build2.4.16805 → 2.4.16828
Commits23
Lines+1112 -387
Read5 min

21 of 21 entries · 23 commits upstream

Stories
# Entry Category Units
1 High ToNcsaShort now requires an exact TShort23 output variable mormot.core.datetime adds TSynSystemTime.AppendTime and AppendInterval for compact time and duration formatting. The public ToNcsaShort var parameter changes from ShortString to TShort23, matching its fixed maximum output. Breaking changes mormot.core.base+1 5b281032+32-5

core: new TSynSystemTime.AppendTime/AppendInterval methods

Impact

Because Pascal var parameters require an exact type, Delphi or FPC callers passing a variable declared as generic ShortString can fail to compile. Callers already using TShort23 remain compatible.

Migration required

Grep for ToNcsaShort. Declare each output variable as TShort23, or call through a TShort23 local and copy it to a wider ShortString afterward.

Public API

  • TSynSystemTime.AppendTimeadded — Appends hh:mm:ss with optional milliseconds.
  • TSynSystemTime.AppendIntervaladded — Formats days plus the TSynSystemTime time fields.
  • TSynSystemTime.ToNcsaShortsignature-changed — The var output type changes from ShortString to TShort23.

Arnaud Bouchez · 07:48 UTC · view the commit on GitHub →

2 High Malformed and overflowing numbers no longer slip through JSON parsing mormot.core.base bounds GetInteger digit accumulation and signed PtrInt limits. mormot.core.text rejects repeated decimal points and exponent overflow in GetExtended. mormot.core.variants enforces JSON number grammar, Int64 and Currency boundaries, and only promotes out-of-range values to varDouble when AllowVarDouble permits it. Fixes mormot.core.base+2 d48f4634+222-25

core: fix numeric conversion overflow and malformed decimal input

Impact

Backends parsing untrusted numeric text no longer receive wrapped integers, malformed decimal acceptance or incorrect Currency variants. Inputs such as leading-zero JSON numbers, empty exponents and values beyond signed bounds now fail instead of being silently coerced.

Public API

  • GetIntegerbehaviour-changed — Overflow now sets err instead of wrapping.
  • GetExtendedbehaviour-changed — Malformed decimals and exponent overflow now set err.
  • GetNumericVariantFromJsonbehaviour-changed — JSON grammar and signed/Currency bounds are now enforced.

Mike · 13:45 UTC · view the commit on GitHub →

3 High DHCP scope updates no longer dereference reallocated storage TDhcpProcess.Setup now copies each old scope into the new array before calling PrepareScope. PrepareScope may change the backing array, so the previous order left the source pointer dangling before it was copied. Fixes mormot.net.dhcp 1cd2f994+5-5

net: fixed GPF or deadlock in TDhcpProcess.Setup()

Impact

A running DHCP service that reapplies or changes scope configuration avoids the documented GPF or deadlock path. This affects both Delphi and FPC backends using mormot.net.dhcp.

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

4 Medium Gregorian encoding becomes public and TryEncode var semantics change mormot.core.datetime publishes EncodeGregorian for validated year, month and day conversion. TryEncodeDate and TryEncodeTime are rewritten with integer checks, and their destination parameter changes from out to var. Breaking changes mormot.core.datetime 20876cb4+83-65

core: new EncodeGregorian() low-level computation function

Impact

Normal direct calls remain source-compatible, but procedure variables, wrappers or overrides that require the exact out signature may stop compiling in Delphi or FPC. Invalid fields continue to return false.

Worth a look

Public API

  • EncodeGregorianadded — Validates year 1..9999, month and day, then returns the internal Gregorian day number.
  • TryEncodeDatesignature-changed — The destination parameter changes from out to var.
  • TryEncodeTimesignature-changed — The destination parameter changes from out to var.

Arnaud Bouchez · 17:18 UTC · view the commit on GitHub →

5 Medium Negative Unix timestamps get an integer-safe conversion TSynSystemTime.FromUnixTime and FromUnixMsTime now split an epoch into day and remainder, adjust negative remainders into the preceding day, then call FromJulianDay with FromSec or FromMS. Fixes mormot.core.datetime 91739dd8+32-12

core: rewritten TSynSystemTime.FromUnixTime/FromUnixMsTime

Impact

Pre-1970 values and millisecond timestamps avoid TDateTime rounding and receive explicit negative-remainder handling on both Delphi and FPC. Ordinary positive timestamps keep the same public result.

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

6 Medium Original Keccak-256 joins the SHA-3 family mormot.crypt.core appends KECCAK_256 to TSha3Algo without shifting existing ordinals and adds Keccak256Full plus Keccak256. The implementation uses original Keccak padding, with vectors for empty, abc and rate-boundary inputs. New features mormot.crypt.core c2bc1bf0+70-5

crypt: support original Keccak-256

Impact

Delphi and FPC backends can compute protocol-compatible Keccak-256 without confusing it with standardized SHA3-256. Existing TSha3Algo values retain their numeric representation.

Worth a look

Public API

  • TSha3Algo.KECCAK_256added — Original Keccak-256 padding and 256-bit output.
  • Keccak256Fulladded — Hashes a buffer into THash256.
  • Keccak256added — Returns lowercase hexadecimal Keccak-256 for a RawByteString.

Mike · 13:26 UTC · view the commit on GitHub →

7 Medium TSynSystemTime can decode a Julian day directly mormot.core.datetime adds TSynSystemTime.FromJulianDay and routes FromDate through the new integer Gregorian decomposition instead of a TDateTime conversion. New features mormot.core.datetime f8fe89b2+46-21

core: new TSynSystemTime.FromJulianDay method

Impact

Delphi and FPC code that already has a Julian day can populate TSynSystemTime without floating-point conversion. Existing FromDate calls keep their interface.

Worth a look

Public API

  • TSynSystemTime.FromJulianDayadded — Populates date fields from a Julian day number.

Arnaud Bouchez · 17:14 UTC · view the commit on GitHub →

8 Medium Microsoft TimeSpan ticks convert to structured and text intervals mormot.core.datetime adds TimeSpanAppendShort, TimeSpanToTextVar, TimeSpanToText and TSynSystemTime.FromTimeSpan. Signed Microsoft 100 ns ticks are split into days and time fields and rendered to millisecond precision. New features mormot.core.datetime 1219fff2+48-2

core: Microsoft TimeSpan 100 ns ticks decoding support

Impact

Delphi and FPC backends can decode directory or .NET duration values without custom arithmetic. Sub-millisecond tick precision is intentionally not present in the rendered result.

Worth a look

Public API

  • TimeSpanAppendShortadded — Appends a formatted Microsoft TimeSpan.
  • TimeSpanToTextVaradded — Writes the interval into a text variant.
  • TimeSpanToTextadded — Returns the formatted interval as RawUtf8.
  • TSynSystemTime.FromTimeSpanadded — Decodes signed 100 ns ticks into days and time fields.

Arnaud Bouchez · 07:49 UTC · view the commit on GitHub →

9 Medium TSynSystemTime can emit Unix milliseconds directly mormot.core.datetime adds TSynSystemTime.ToUnixMsTime and rewrites ToUnixTime around EncodeGregorian, using integer day and time arithmetic instead of TDateTime conversion. New features mormot.core.datetime c5731496+15-7

core: new TSynSystemTime.ToUnixTime/ToUnixMSTime methods

Impact

Backends can obtain millisecond epochs without a floating-point intermediate. Existing ToUnixTime callers keep the same signature while receiving the new integer implementation.

Worth a look

Public API

  • TSynSystemTime.ToUnixMsTimeadded — Returns milliseconds since the Unix epoch.
  • TSynSystemTime.ToUnixTimebehaviour-changed — Now uses integer Gregorian arithmetic.

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

10 Medium LDAP can render Microsoft TimeSpan attributes mormot.net.ldap adds atsTimeSpan to TLdapAttributeTypeStorage. Attribute decoding reads the signed 100 ns tick value and passes it to TimeSpanToTextVar for a human-readable interval. New features mormot.net.ldap 22e8328a+9-2

net: introducing atsTimeSpan LDP attribute decoding

Impact

LDAP backends can map Microsoft duration attributes to text instead of leaving their 64-bit tick representation opaque. Existing attribute storage modes keep their ordinals because the new member is appended.

Worth a look

Public API

  • TLdapAttributeTypeStorage.atsTimeSpanadded — Decodes signed Microsoft TimeSpan ticks to text.

Arnaud Bouchez · 08:28 UTC · view the commit on GitHub →

11 Medium TTimeLogBits Unix conversion avoids TDateTime arithmetic mormot.core.datetime routes TTimeLogBits.FromUnixTime through TSynSystemTime, derives FromUnixMsTime at second precision, and computes ToUnixTime with EncodeGregorian integer arithmetic. Performance mormot.core.datetime f5669b62+20-19

core: enhanced TTimeLogBits conversion methods

Impact

Delphi and FPC backends get deterministic integer conversion and avoid floating-point rounding. TTimeLogBits still stores only whole seconds, so millisecond input is intentionally truncated.

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

12 Medium Database date adapters share the zero-on-invalid encoders mormot.core.datetime, mormot.db.raw.odbc and mormot.db.raw.oracle replace repeated TryEncodeDate and TryEncodeTime branches with EncodeDateOrZero and EncodeTimeOrZero in ISO, SQL_TIMESTAMP_STRUCT and TOracleDate conversion paths. Under the hood mormot.core.datetime+2 d7a78957+36-73

core/db: use EncodeDateOrZero/EncodeTimeOrZero when possible

Impact

The intended invalid-input result remains zero, but Delphi/FPC database backends now use the same validation implementation. Existing ODBC and Oracle application calls do not change.

Arnaud Bouchez · 17:22 UTC · view the commit on GitHub →

13 Low Date and time encoders add zero-returning wrappers mormot.core.datetime publishes EncodeDateOrZero and EncodeTimeOrZero. Each delegates to its TryEncode counterpart and returns zero when the supplied fields are invalid. New features mormot.core.datetime 1d5e8861+35-2

core: introducing EncodeDateOrZero/EncodeTimeOrZero wrappers

Impact

Delphi and FPC callers can replace a boolean branch when zero is an acceptable invalid sentinel. Existing APIs and behavior are unchanged.

Worth a look

Public API

  • EncodeDateOrZeroadded — Returns zero for invalid date fields.
  • EncodeTimeOrZeroadded — Returns zero for invalid time fields.

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

14 Low ISO time fragments gain a reusable buffer parser mormot.core.datetime adds TSynSystemTime.FromTimeBuffer to parse hour, minute and optional second fields from a pointer and length. FromHttpDateBuffer reuses it for the time portion. New features mormot.core.datetime e570e19e+23-10

core: new TSynSystemTime.FromTimeBuffer method

Impact

Buffer-oriented parsers can fill TSynSystemTime without allocating a string. Existing HTTP date parsing retains its accepted layout while sharing the helper.

Worth a look

Public API

  • TSynSystemTime.FromTimeBufferadded — Parses a time from a pointer and byte length.

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

15 Low POSIX epoch conversion uses the optimized Gregorian splitter The POSIX EpochToSystemTime implementation in mormot.core.os.posix is rewritten around the shared DaysToGregorian integer routine instead of the previous calendar decomposition. Performance mormot.core.os.posix 5313e545+34-29

core: rewritten EpochToSystemTime() on POSIX

Impact

POSIX Delphi/FPC backends reduce calendar-conversion work. There is no public signature change and no application migration.

Arnaud Bouchez · 17:08 UTC · view the commit on GitHub →

16 Low Leap-year checks move to division-free integer arithmetic mormot.core.datetime rewrites IsLeapYear with inline integer comparisons and reciprocal arithmetic instead of modulo divisions, preserving the Gregorian leap-year rule. Performance mormot.core.datetime 8d552e6b+26-30

core: rewritten IsLeapYear()

Impact

No application code changes. Repeated calendar conversion is cheaper on Delphi and FPC while returning the same leap-year decisions.

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

17 Low HTTP dates now use the integer system-time conversion path mormot.core.datetime makes TSynSystemTime.FromHttpDateBuffer reuse FromTimeBuffer and converts parsed HTTP dates with TSynSystemTime.ToUnixTime instead of a TDateTime intermediate. The tolocaltime parameter now has a false default. Performance mormot.core.datetime e498b9ef+12-14

core: enhanced HTTP date support

Impact

Existing explicit calls keep their behavior. Callers omitting tolocaltime now compile against a documented UTC default, and HTTP parsing avoids floating-point date conversion on Delphi and FPC.

Public API

  • TSynSystemTime.FromHttpDateBuffersignature-changed — tolocaltime now defaults to false.

Arnaud Bouchez · 17:24 UTC · view the commit on GitHub →

18 Low Delphi Win64 year formatting replaces division with multiplication mormot.core.base adds DIV100_INV and uses reciprocal multiplication in the Delphi Win64 YearToPChar assembly path. Existing x86 and x64 assembly literals are consolidated around the same constant. Performance mormot.core.base+2 906a9037+16-10

core: optimized YearToPChar() for Delphi Win64

Impact

Only Delphi Win64 formatting should become cheaper; FPC and other targets keep equivalent code. Application calls and output are unchanged.

Public API

  • DIV100_INVadded — Public reciprocal constant used for division by 100.

Arnaud Bouchez · 17:07 UTC · view the commit on GitHub →

19 Low Positive and negative TimeSpan values gain regression tests test.core.base adds assertions for Microsoft TimeSpan conversion in both directions, including signed intervals. The production-unit edit clarifies the 100 ns tick scale. Tests mormot.core.os d3dfb00c+27-3

tests: validate TimeSpan conversion

Impact

No application code changes. Delphi and FPC builds gain coverage for sign handling and the text format introduced by the preceding commit.

Arnaud Bouchez · 07:50 UTC · view the commit on GitHub →

20 Low Date, Unix and hash boundary cases gain regression coverage test.core.base adds leap-year, Unix second and Unix millisecond round trips plus HTTP date assertions. test.core.crypt adds extra SHA-3 and Keccak boundary coverage. Tests 6356fbaa+17-6

tests: cover latest date/time conversion functions

Impact

No application code changes. Delphi and FPC builds gain regression coverage for the conversion paths introduced in this batch.

Arnaud Bouchez · 17:25 UTC · view the commit on GitHub →

21 Low Internal names and declarations are cleaned without behavior changes Several core, search, thread and DHCP declarations are renamed, reordered or clarified. The embedded diff and commit message identify no functional change or public API removal. Housekeeping mormot.core.datetime+3 bebea2f9+12-12

all: some code cleaning with no functional change

Impact

No impact on application code, Delphi/FPC behavior or stored data; this is source cleanup only.

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

Upstream activity commits per day · last 60 days
Commits977
Active days44/60
Busiest2026-09-30
Peak60
2026-08-15: 0 commits2026-08-16: 0 commits2026-08-17: 0 commits2026-08-18: 0 commits2026-08-19: 0 commits2026-08-20: 0 commits2026-08-21: 0 commits2026-08-22: 0 commits2026-08-23: 0 commits2026-08-24: 0 commits2026-08-25: 0 commits2026-08-26: 0 commits2026-08-27: 26 commits2026-08-28: 11 commits2026-08-29: 10 commits2026-08-30: 1 commit2026-08-31: 23 commits2026-09-01: 0 commits2026-09-02: 20 commits2026-09-03: 29 commits2026-09-04: 35 commits2026-09-05: 13 commits2026-09-06: 0 commits2026-09-07: 0 commits2026-09-08: 23 commits2026-09-09: 10 commits2026-09-10: 17 commits2026-09-11: 23 commits2026-09-12: 14 commits2026-09-13: 9 commits2026-09-14: 7 commits2026-09-15: 4 commits2026-09-16: 24 commits2026-09-17: 26 commits2026-09-18: 21 commits2026-09-19: 59 commits2026-09-20: 13 commits2026-09-21: 5 commits2026-09-22: 34 commits2026-09-23: 17 commits2026-09-24: 57 commits2026-09-25: 22 commits2026-09-26: 26 commits2026-09-27: 0 commits2026-09-28: 2 commits2026-09-29: 19 commits2026-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: 33 commits2026-10-11: 9 commits2026-10-12: 11 commits2026-10-13: 35 commits
2026-08-152026-10-13