A misconfigured sensor can expose a memory defect that ordinary tests miss. Dynamic analysis tests code while it runs, observing defects in the execution paths and inputs exercised. In safety-critical C++, it is one part of a systematic memory-safety process, alongside safe design patterns, static analysis, and code review. section 1.7 section 1.10
Listing 1.1 Sensor label copy without bounds check
void ProcessSensorReading(std::span<const std::uint8_t> raw_data) {
constexpr std::size_t kMaxLabelLength = 32; #A
std::array<char, kMaxLabelLength> sensor_label{}; #B
auto reading = ParseSensorData(raw_data);
std::copy(reading.label.begin(), #C
reading.label.end(),
sensor_label.begin());
LogReading(sensor_label.data(), reading.value); #D
}
The sensor label is copied into a 32-byte array without a bound check; the label length determines where a defect appears. section 1.7
Test the boundary
Run the test suite with AddressSanitizer (ASan) enabled and exercise labels of 31, 32, and 33 bytes. At 32 bytes, ASan reports the missing terminator at LogReading; at 33 bytes, it reports the out-of-bounds copy at std::copy. A 31-byte label produces correct output and no ASan report, even though the code remains defective. Tests using only short labels can therefore leave the dangerous cases unexercised. section 1.7
A clean runtime report is evidence about the executions tested, not proof that every input is safe. Use boundary value analysis to choose revealing cases, and combine runtime testing with static analysis and review. section 1.7 section 1.10


