Skip to content

Swmm6 rel#70

Merged
cbuahin merged 14 commits into
developfrom
swmm6_rel
May 23, 2026
Merged

Swmm6 rel#70
cbuahin merged 14 commits into
developfrom
swmm6_rel

Conversation

@cbuahin
Copy link
Copy Markdown
Member

@cbuahin cbuahin commented May 23, 2026

No description provided.

cbuahin added 4 commits May 23, 2026 00:17
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 23, 2026

CLA assistant check
All committers have signed the CLA.

cbuahin added 6 commits May 23, 2026 05:30
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
cbuahin added 3 commits May 23, 2026 11:20
sstrncpy(dest, src, n) copies up to n source chars and writes the
null terminator at dest[n], so the buffer must be n+1 bytes. The
realpath() rework in d7c4360 passed `size` (the full buffer size)
as `n`, which writes one byte past the end of InpDir when the
resolved path is >= sizeof(InpDir). Pass `size - 1` instead, clear
absPath on realpath() failure, and clamp the absolute-path else
branch to size-1 (was previously unbounded).

Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
When ctest fails on the Linux runner, re-run each of the five legacy
solver test binaries under gdb to capture the backtrace in the workflow
log. No-op on macOS/Windows and when ctest passes.

Signed-off-by: cbuahin <caleb.buahin@gmail.com>
Root cause of the Linux x64 Debug ctest segfaults in
test_legacy_solver_{api,errors,hotstart,shapes,expanded_api}.

The root CMakeLists sets CMAKE_C_EXTENSIONS OFF, so CMake passes
-std=c17 (strict ANSI) instead of -std=gnu17. Under __STRICT_ANSI__,
glibc's <stdlib.h> hides realpath() because it's a POSIX extension.
swmm5.c::getAbsolutePath() then calls realpath() with no visible
prototype, so gcc falls back to implicit-int — the 64-bit char*
return is truncated to 32 bits, sstrncpy() dereferences the garbage
pointer, and SIGSEGV.

gdb backtrace from the CI logs (with the gdb step added in 0daaf10):
  #0 sstrncpy (dest=<InpDir>, src=0x5562ba20 <Cannot access memory>, n=259)
  #1 getAbsolutePath (..., size=260) at swmm5.c:2770
  #2 swmm_open (...)                  at swmm5.c:583

Apple's libc exposes realpath unconditionally and Windows uses the
GetFullPathName branch, which is why this only bit Linux. The
previous CI was silently building Release (-O2 -flto), where LTO
sees the real prototype across TUs and avoids the truncation;
commit a786683 unmasked the bug by letting the Debug preset
actually build Debug.

Signed-off-by: cbuahin <caleb.buahin@gmail.com>
@cbuahin cbuahin merged commit 2f4d0a0 into develop May 23, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants