Commit graph

8 commits

Author SHA1 Message Date
Stephen Dennis
2f1a0f1e30 fix(cron): reject trailing tokens after five-field schedule (#1870)
cron_add accepted any non-whitespace after the fifth field (parse pointer
ignored).  Require end-of-string after optional trailing whitespace so
inputs like '* * * * * garbage' are rejected.  Smoke case TC006b.
2026-07-31 09:05:11 -06:00
Stephen Dennis
940148dbb6 nls: mark walkdb/cron/conf search-and-admin notify prose with M_() (#1683)
Phase 3 coverage, away from the mux_table lane:

  walkdb  @search/@chown/@mark, universe stats, coin checks
  cron    remove/match counts via MN_(), list/bad-entry lines
  conf    config thing not found / already exists (notify path)

Search-class keywords, softcode tokens, and logs stay T(). pot grows;
xx.po rebuilt clean for complete catalogue; ko msgmerge only.
2026-07-28 15:15:30 +00:00
Stephen Dennis
7dea5b97ce nls: mark remaining small engine notify piles with M_ (#1419)
Sweep the leftover constant notify/raw_notify sites outside the large
already-sliced files: mguests listing chrome, @function denials,
boolexp lock errors, login/page-lock notes, dump progress, @cron usage,
attrcache chrome, @dbclean error, funceval rummaging/step size (~20
sites). Leave blank-line T("") alone (#1443) and tprintf formats as T().
Half-mark pass clean. Regenerate pot/xx without fuzzy entries.
2026-07-27 12:40:51 +00:00
Stephen Dennis
301a7664d0 nls: mark db/cron/powers/session misc notify prose with M_ (#1419)
Remaining small engine notify piles (~45 sites across db, cron, powers,
session, object, conf, help, log). Leave tprintf formats as T().
Half-mark pass clean. Regenerate pot/xx without fuzzy entries.
2026-07-27 11:50:31 +00:00
Stephen Dennis
a42d69e95a Fix memory-safety bugs in softcode functions, examine, @reference, @cron
Memory-safety pass over previously unsurveyed engine subsystems. Six
confirmed, adversarially-verified bugs, all reachable from untrusted
player input:

 - scramble()/shuffle(): Fisher-Yates index arrays were sized LBUF_SIZE/2
   but the cluster/word count can reach LBUF_SIZE, so a ~32 KB argument
   overflowed the stack array. Both are CA_PUBLIC. (#845)
 - view_atr()/flags(): decode_attr_flags() can emit NUM_ATTRIBUTE_CODES+1
   bytes but two callers gave it an 11-byte buffer. (#846)
 - do_reference()/absolute_named_reference(): used snprintf's return value
   (intended length) directly as a copy/compare length, reading past the
   buffer on truncation; @reference could leak the adjacent heap bytes back
   via @reference/list. Clamped to min(n, LBUF_SIZE-1). (#847)
 - @cron value/step parsing accumulated digits into a signed int without an
   overflow guard (UB). (#848)
 - index(): trailing-space trim decremented before testing, reading the byte
   before the lbuf when an item begins at the delimiter. (#849)

Adds regression tests TC012-TC014 to overflow_inject_fn.mux. Build clean,
all 1258 smoke tests pass. Coverage recorded in
docs/survey-memsafety-pass-2026-06.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 05:12:28 -06:00
Stephen Dennis
222ae8b29f Fix Windows agent build rework issues; refactor PCG RNG portability
Three fixes for the Unix build after 68acbd2e:

1. cron.cpp: Fix infinite recursion in ctz64() — the non-MSVC path
   called itself instead of __builtin_ctzll(). This caused 100% CPU
   hang on first @cron command.

2. modules.cpp/externs.h: Move CConnectionManagerFactory and
   CDriverControlFactory declarations from externs.h into modules.cpp
   where they are actually used. Eliminates the BUILDING_DRIVER
   preprocessor guard entirely — no cross-build-system coordination
   needed.

3. svdrand.cpp: Gate PCG variant on __SIZEOF_INT128__ (compiler
   capability) instead of _MSC_VER (compiler identity). Extracts
   gather_entropy() with platform-specific paths. Replaces C-style
   casts with static_cast/reinterpret_cast. PCG-XSL-RR-128/64 on
   any compiler with __uint128_t; PCG-XSH-RR-64/32 otherwise.

493/493 smoke tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 10:03:04 -06:00
Stephen Dennis
68acbd2eea Rework Windows build for component-based directory layout
Adapt all vcxproj files and solution to the new directory structure
(src/ driver, lib/ shared library, modules/engine/ game logic,
modules/{comsys,mail,exp3,sqlproxy,sqlslave}/ loadable modules).

Key changes:
- libmux.dll exports utility symbols via LIBMUX_API macro
  (__declspec(dllexport) when BUILDING_LIBMUX, dllimport otherwise)
- LIBMUX_API added to all shared headers: stringutil.h, timeutil.h,
  mathutil.h, utf8tables.h, svdhash.h, svdrand.h, sha1.h, alloc.h,
  dbutil.h, core.h
- Per-file PreprocessorDefinitions in libmux.vcxproj inherit from
  project-level via %(PreprocessorDefinitions)
- Driver factory declarations (CDriverControlFactory,
  CConnectionManagerFactory) guarded with BUILDING_DRIVER
- PCG-XSH-RR-64/32 (pcg32) for Windows (no __int128 needed);
  Unix PCG-XSL-RR-128/64 unchanged
- MSVC portability fixes: _strnicmp, _BitScanForward64, (std::min)(),
  HAVE_WORKING_FORK guards, WINDOWS_FILES/UNIX_FILES ModuleAdd paths
- Remove stubslave.cpp and slave.cpp from netmux.vcxproj (separate
  processes)
- Fix sqlproxy/sqlslave vcxproj relative paths for new layout
- Add ws2_32.lib to engine.vcxproj for socket functions
- Add strcasecmp/strtok_r/strndup compat shims for comsys/mail

Builds successfully: libmux.dll, engine.dll, netmux.exe, exp3.dll,
sqlproxy.dll, sqlslave.dll. Comsys/mail blocked on sqlite3 linking
architecture (need COM-mediated or independent sqlite3 linkage).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:38:57 -06:00
Stephen Dennis
48aca66fbf Add @cron/@crondel/@crontab with Vixie-style scheduler integration
5-field Unix cron syntax (minute hour dom month dow) with ranges,
lists, steps, and month/day-of-week names. Computed next-fire-time
scheduling integrates with CScheduler — no polling loop. In-memory
storage, recreated via @startup. DOM/DOW OR-semantics per Vixie cron.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:34:06 -06:00