Fixed SIGSEGV

This commit is contained in:
deeaitch committed 2026-10-23 21:04:43 -04:00
1 parent f03882d3f4
commit 5b0019d50d
50 files changed
+1565 -821

No files matched your search

+4 -4
View File
@@ -645,7 +645,7 @@ Multiplexing</h1>
<div class="line"> SG_ Value m0 : 16|8@1+ (1,0) [0|255] &quot;&quot; ECU</div>
<div class="line">SG_MUL_VAL_ 1 Child Root 1-2, 4-4;</div>
<div class="line">SG_MUL_VAL_ 1 Value Child 3-5;</div>
</div><!-- fragment --><p>Here <code>Value</code> is active when <code>Root</code> is 1, 2, or 4 <b>and</b> <code>Child</code> is 3 through 5. Explicit ranges override the marker value. Repeated statements for the same signal/selector merge their range alternatives. Each signal has at most one parent selector; conflicting parent references are rejected. Multiple independent root selectors are supported. Statements and selectors may precede or follow their targets. Decimal values retain the full <code>uint64_t</code> range and must fit the parent's bit width. Ranges are stored without expanding individual values. Malformed ranges, unresolved references, signed selectors, ambiguous implicit selectors, and dependency cycles produce <code>InvalidMultiplexing</code> diagnostics. Statement errors retain the <code>SG_MUL_VAL_</code> source line; graph and overlap errors identify the affected signal declaration.</p>
</div><!-- fragment --><p>Here <code>Value</code> is active when <code>Root</code> is 1, 2, or 4 <b>and</b> <code>Child</code> is 3 through 5. Explicit ranges override the marker value. Repeated statements for the same signal/selector merge their range alternatives. Each signal has at most one parent selector; conflicting parent references are rejected. Multiple independent root selectors are supported. Statements and selectors may precede or follow their targets. Decimal values retain the full <code>uint64_t</code> range and must fit the parent's bit width. Ranges are stored without expanding individual values. <code>SG_MUL_VAL_</code> headers, decimal bounds, and range lists are scanned iteratively, without regular expressions or a new statement-length limit. Long valid lists are preserved; malformed ranges and trailing text produce source-located errors. Malformed ranges, unresolved references, signed selectors, ambiguous implicit selectors, and dependency cycles produce <code>InvalidMultiplexing</code> diagnostics. Statement errors retain the <code>SG_MUL_VAL_</code> source line; graph and overlap errors identify the affected signal declaration.</p>
<p>Signal bits may overlap only when the complete ancestor conditions prove the signals mutually exclusive: at least one shared selector has disjoint ranges. This includes nested siblings using the same payload bits and independent selectors, whose branches may be active simultaneously. Validation uses Intel or Motorola bit traversal, including mixed byte orders. Metadata survives runtime and tree builders; the optional Qt adapter does not add multiplexing roles yet.</p>
<p>The decoder checks ancestors from root to leaf using <b>raw unsigned values</b>. An inactive ancestor leaves descendants inactive even if their selector bytes are absent. Missing bytes on an otherwise active selector path produce <code>SelectorUnavailable</code>. Selective decoding reads required ancestors internally; result order remains selection or definition order. Factor, offset, and <code>VAL_</code> descriptions do not influence branch selection.</p>
<p>Each result has <code>SignalDecodeStatus status</code>:</p>
@@ -876,7 +876,7 @@ Signal value descriptions (&lt;tt&gt;VAL_&lt;/tt&gt;)</h1>
<div class="fragment"><div class="line">BO_ 256 Status: 8 ECU</div>
<div class="line"> SG_ State : 0|8@1+ (1,0) [0|255] &quot;&quot; ECU</div>
<div class="line">VAL_ 256 State 0 &quot;Off&quot; 1 &quot;On&quot; 2 &quot;Error&quot;;</div>
</div><!-- fragment --><p>Each statement must occupy one physical line, contain at least one integer/text pair, and end with a semicolon. Spaces and tabs are accepted between fields; descriptions may contain whitespace, semicolons, and empty text. Inside quoted text, escape a quote or a backslash with a preceding backslash; other escapes are rejected. Keys are decimal integers in <code>INT64_MIN..UINT64_MAX</code>, with an optional minus sign; plus signs, fractions, hexadecimal numbers, exponents, and overflow are rejected. Keys never pass through <code>double</code>.</p>
</div><!-- fragment --><p>Each statement must occupy one physical line, contain at least one integer/text pair, and end with a semicolon. Spaces and tabs are accepted between fields; descriptions may contain whitespace, semicolons, and empty text. Inside quoted text, escape a quote or a backslash with a preceding backslash; other escapes are rejected. Headers, quoted descriptions, and pairs are scanned iteratively, without regular expressions or repeatedly removing the parsed prefix. Long valid descriptions and lists are preserved without a new length limit; malformed input returns the same source-located diagnostics as short statements. Keys are decimal integers in <code>INT64_MIN..UINT64_MAX</code>, with an optional minus sign; plus signs, fractions, hexadecimal numbers, exponents, and overflow are rejected. Keys never pass through <code>double</code>.</p>
<p><code>VAL_</code> may appear before or after its frame and signal declarations. References are resolved after reading the file using the same CAN ID normalization as <code>BO_</code>, including bit 31 for extended identifiers. Standard and extended frames with the same normalized ID remain distinct. Missing or ambiguous references, malformed statements, and duplicate integer keys produce <code>path:line: description</code> errors at the originating <code>VAL_</code> line. Distinct keys from multiple statements are merged; <code>0</code>, <code>00</code>, and <code>-0</code> are the same key. Keys need not fit the referenced signal's bit width or signedness; unreachable keys simply cannot match a decode.</p>
<p>Mappings are available as <code><a class="el" href="structSignalInfo.html#a43f47d0433d0cc39076bd7278b46af9c">SignalInfo::valueDescriptions</a></code> and <code><a class="el" href="structDecodeSignal.html#a822155d9bf4ed5f3300c9e9befe606ff">DecodeSignal::valueDescriptions</a></code>, and survive both database builders, including <code><a class="el" href="classTreeNode.html#a226518612d0d00b5988a2c44fc21d3f1" title="Get signal payload if node is signal.">TreeNode::GetSignal()</a></code>. Consumers can look up a decoded result directly:</p>
<div class="fragment"><div class="line"><span class="keyword">const</span> <a class="code hl_struct" href="structDecodedSignalValue.html">DecodedSignalValue</a> &amp;value = decodedFrame.signals.at(0);</div>
@@ -972,7 +972,7 @@ Build Integration</h1>
</div><!-- fragment --><p><code>core/core_files.pri</code> lists the library sources and headers. Consumers include <code>core/core.pri</code> for include paths and library linkage; the test source lists live in <code>tests/parser_tests.pri</code> and <code>tests/decoder_tests.pri</code>. When building a consumer separately, pass <code>DBC_CORE_BUILD_DIR=/absolute/path/to/build/core</code> to qmake.</p>
<h2><a class="anchor" id="autotoc_md147"></a>
Local core regression checks</h2>
<p>Run <code>bash tests/run_core_ci.sh release</code> or <code>bash tests/run_core_ci.sh sanitize</code> to build the core archive with Qt 6.8.2, run all six core QtTest suites (parser, decoder, coverage, lifetime, validation, and pipeline/builder integration), and run both the qmake and standalone Qt-free tree tests. The sanitizer mode uses AddressSanitizer and UndefinedBehaviorSanitizer, with leak detection enabled by default and fatal sanitizer errors.</p>
<p>Run <code>bash tests/run_core_ci.sh release</code> or <code>bash tests/run_core_ci.sh sanitize</code> to build the core archive with Qt 6.8.2, run all seven core QtTest suites (parser, statement robustness, decoder, coverage, lifetime, validation, and pipeline/builder integration), and run both the qmake and standalone Qt-free tree tests. The sanitizer mode uses AddressSanitizer and UndefinedBehaviorSanitizer, with leak detection enabled by default and fatal sanitizer errors.</p>
<p>See <a href="tests/README.md#local-regression-checks">Local regression checks</a> for prerequisites and environment overrides. No automatic CI workflow is configured.</p>
<h2><a class="anchor" id="autotoc_md148"></a>
Build core without Qt libraries</h2>
@@ -1080,7 +1080,7 @@ Regression tests</h1>
<p>See <a class="el" href="md_tests_2README.html">tests/README.md</a> for QtTest build and execution commands. Tests cover frame validation and error locations, Intel and Motorola extraction, signal syntax and payload bounds, <code>VAL_</code> syntax and reference validation, raw description lookup and preservation through both builders, statement dispatch, signed and unsigned 64-bit boundaries, physical conversion, numeric output, and invalid signal payloads. <code><a class="el" href="dbc__pipeline__test_8cpp_source.html">dbc_pipeline_test.cpp</a></code> follows temporary DBC fixtures through parsed metadata, runtime frame/signal lookups, decoded raw/physical values and descriptions, and tree nodes. It verifies all supported metadata in both builders, standard and extended frames sharing a numeric ID, empty databases, comments, and replacement with another fixture or an empty database.</p>
<h1><a class="anchor" id="autotoc_md155"></a>
Code review and additional checks</h1>
<p>Attribute numeric parsing shares one locale-independent converter for integer and floating-point values. Default application skips unrelated scopes, CAN ID normalization uses the validated identifier mask, and signal layout validation owns the length checks. Statement handlers continue to use <code><a class="el" href="classTypeFactory.html" title="Registry-based factory for creating objects by runtime identifier.">TypeFactory</a></code>. Core, adapter, example, and test C++ sources use explicit return types and contain no lambdas. Public metadata and parser-state comments use Doxygen descriptions.</p>
<p>Attribute numeric parsing shares one locale-independent converter for integer and floating-point values. Default application skips unrelated scopes, CAN ID normalization uses the validated identifier mask, and signal layout validation owns the length checks. Statement handlers continue to use <code><a class="el" href="classTypeFactory.html" title="Registry-based factory for creating objects by runtime identifier.">TypeFactory</a></code>. Core, adapter, example, and test C++ sources use explicit return types and contain no lambdas. DBC statement parsing uses iterative scanners rather than regular expressions. Public metadata and parser-state comments use Doxygen descriptions.</p>
<p>See <a href="tests/README.md#extended-validation">tests/README.md</a> for attribute boundary regressions, sanitizer commands, and the latest validation results.</p>
<h1><a class="anchor" id="autotoc_md156"></a>
Measuring code coverage</h1>