param_cnt: fix segfault on missing transcript source; guard corpus dir setters - #68
Merged
Merged
Conversation
…r setters param_cnt read -sentdir/-sentext without registering them, so omitting -lsnfn passed a null directory into corpus_set_sent_dir(), which dereferenced it in strrchr() and crashed before the control file was even opened. - Register -sentdir/-sentext in param_cnt's argument table (as agg_seg and bw already do), restoring the per-utterance sent-directory transcript path. - Require a transcript source in initialize(): -lsnfn, else -sentdir/-sentext, else a named error instead of passing a null directory onward. - Null-guard corpus_set_sent_dir() and corpus_set_seg_dir() so a null directory returns an error rather than dereferencing null, defending every caller. Fixes #67.
lenzo-ka
force-pushed
the
kal-param-cnt-sentdir-crash
branch
from
August 16, 2026 23:16
c883b2c to
8f56df6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #67.
param_cntsegfaulted whenever-lsnfnwas omitted: it read-sentdir/-sentext, which it never registered, socmd_ln_str()returned NULL andcorpus_set_sent_dir()dereferenced it instrrchr(dir, ',')— crashing beforethe control file was opened. This is a hard crash, separate from the
silent-failure work in #65/#66.
What changes
-sentdir/-sentextinparam_cnt's argument table, matchingagg_segandbw. This restores the per-utterance sent-directory transcriptpath that the code already tried to use.
initialize():-lsnfn, else-sentdir(with
-sentext), else a named error — instead of passing a null directoryonward.
corpus_set_sent_dir()andcorpus_set_seg_dir()so a nulldirectory returns
S3_ERRORrather than dereferencing null. These are sharedlibiosetters, so the guard protects every caller, not justparam_cnt.Verification
Builds clean (no new warnings). Before:
param_cnt -paramtype phone -ctlfn …without
-lsnfnexits 139 (SIGSEGV). After: it printsYou must specify a word transcript source: -lsnfn, or -sentdir with -sentextand exits 1. Supplying-lsnfnis unchanged; supplying-sentdirnow reachescorpus_set_sent_dir()with a real path.
Relationship to #66: independent. #66 (issue #65) makes
-segdirrequired onlyfor
state/cbcounting; this PR fixes the transcript-source crash and hardensthe shared corpus setters. The two touch adjacent lines in
initialize()andmay need a trivial merge resolution depending on merge order.