Repository navigation
Description
Describe the bug
With TrajectoryManagement.enableReAssoc: 1 and dynamic Kalman noise (StateEstimator.noiseWeightVar4Loc / noiseWeightVar4Vel > 0) set together, the low-level tracker writes 8 bytes outside the covariance matrix of the trajectory projector every time a track reaches minTrajectoryLength4Projection. The heap corruption shows up later in unrelated places: double free or corruption (!prev), free(): invalid pointer, or SIGSEGV.
The trajectory projector is created with 6 states (NvTrajectoryManager.cpp#L1942):
m_trajProjector[streamId] = std::make_shared<SimpleEstimator2>(m_configFilePath, 6, 4, true);In the dynamic-noise branch of SimpleEstimator2::initStates(), P(7,7) is scaled unconditionally (SimpleEstimator2.cpp#L244):
m_P(4,4) *= 100.0;
m_P(5,5) *= 100.0;
m_P(7,7) *= 100.0; // the projector's P is 6x6: index 7 is out of boundsEigen does not bounds-check in release builds, so this is a silent out-of-bounds read and write. In the DeepStream 7.1 aarch64 binary it is the store at libnvds_nvmultiobjecttracker.so + 0x62c14. The code is unchanged on develop (3091168).
None of the shipped presets enables both features (NvDCF_accuracy has re-association with constant noise; NvSORT/NvDeepSORT have dynamic noise without re-association). It is hit when combining modules, for example NvSORT-style dynamic noise with NvDCF's re-association on a Jetson without the GPU budget for the visual tracker.
Steps/Code to reproduce bug
A standalone reproduction on the stock nvcr.io/nvidia/deepstream:7.1-triton-multiarch image is attached (nvmot-repro.zip: nvmot_repro.cpp, config_repro.yml, Dockerfile, run.sh). The program drives the library through the public NvMOT API with synthetic boxes (4 streams × 10 moving boxes, 100 frames per tracker context). It needs no video, GStreamer or models.
Minimal config:
%YAML:1.0
BaseConfig:
minDetectorConfidence: 0.3
TargetManagement:
maxTargetsPerStream: 150
probationAge: 1
maxShadowTrackingAge: 60
TrajectoryManagement:
useUniqueID: 0
enableReAssoc: 1
minTrajectoryLength4Projection: 25
prepLength4TrajectoryProjection: 50
trajectoryProjectionLength: 60
maxTrackletMatchingTimeSearchRange: 60
DataAssociator:
dataAssociatorType: 0
associationMatcherType: 1
checkClassMatch: 1
StateEstimator:
stateEstimatorType: 2
noiseWeightVar4Loc: 0.0503
noiseWeightVar4Vel: 0.0037
useAspectRatio: 0
VisualTracker:
visualTrackerType: 0
ReID:
reidType: 0Steps:
unzip nvmot-repro.zip && cd repro && ./run.shResults:
| Test | Result |
|---|---|
| Plain run, 10 tracker contexts in a row, repeated 4× | Crashes every time after 1–7 contexts (double free or corruption (!prev)) |
| Valgrind, config above | Invalid write of size 8 at libnvds_nvmultiobjecttracker.so+0x62c14 |
Valgrind, useAspectRatio: 1 |
Same invalid write |
Valgrind, enableReAssoc: 0 |
0 errors (20/20 plain runs clean) |
Valgrind, constant noise (noiseWeightVar4Loc/Vel unset) |
0 errors |
Valgrind excerpt:
==1== Invalid write of size 8
==1== at 0x53B2C14: ??? (in /opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_nvmultiobjecttracker.so)
==1== by 0x53B37FF: ??? (in /opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_nvmultiobjecttracker.so)
==1== by 0x5398AC7: ??? (in /opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_nvmultiobjecttracker.so)
==1== by 0x53993CB: ??? (in /opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_nvmultiobjecttracker.so)
Expected behavior
No out-of-bounds access: P(7,7) should only be scaled when the filter has 8 states.
Fix is on my fork:
- Branch: https://github.com/TheGoncaloSilva/DeepStream/tree/fix-trajectory-projector-p77 (based on
develop3091168) - Commit: TheGoncaloSilva@53ed613 (DCO signed off)
m_P(5,5) *= 100.0;
- m_P(7,7) *= 100.0;
+ /// Height velocity h' exists only in the 8-state model; the 6-state trajectory projector has no index 7.
+ if (m_numTotalStates > 7)
+ {
+ m_P(7,7) *= 100.0;
+ }The 8-state tracking filter is unchanged; the 6-state projector still scales its two velocity entries (4,4) and (5,5).
The same guard applied to the 7.1 binary gives 100 tracker contexts in a row with 0 valgrind errors, identical tracker output before any projection, and in a 4-camera pipeline 0 crashes in 12 starts (10 in 12 without it).
Workarounds until fixed: enableReAssoc: 0, or constant noise. useAspectRatio: 1 does not help.
Environment details (please complete the following information):
- Environment location: Docker on bare-metal Jetson Orin Nano (Super), JetPack 6.2 (L4T R36.4.7)
- Method of DeepStream install: Docker
docker pull nvcr.io/nvidia/deepstream:7.1-triton-multiarchdocker build -t nvmot-repro:7.1 .(stock image + valgrind, see attachedDockerfile)docker run --rm --runtime nvidia --entrypoint /repro/nvmot_repro nvmot-repro:7.1 /repro/config_repro.yml 10 100
scripts/print_env.sh: not run (reproduced with the DeepStream 7.1 binary; the faulty lines are unchanged in thedevelopsource)
Additional context
Also seen in production on several Jetson Orin devices as random glibc heap aborts minutes after start. Building it with AddressSanitizer (-fsanitize=address) and running the attached test should flag the same line.
Activity
nvmultiobjecttracker: guard P(7,7) in SimpleEstimator2 for the 6-stat…
kevinsongbing commentedon Nov 17, 2026
Seems reasonable, we will check and feedback later.
kevinsongbing commentedon Nov 18, 2026
Please submit PR based on the guide: https://github.com/NVIDIA/DeepStream/blob/main/PULL_REQUEST_GUIDELINES.md . Suggest to use NvDCF tracker(config_tracker_NvDCF_accuracy.yml) for Target Re-Association feature in your project.
fix(nvmultiobjecttracker): guard P(7,7) scaling for the 6-state traje…
TheGoncaloSilva commentedon Nov 18, 2026
Thanks for the suggestion. Some context on our setup and why we don't use
config_tracker_NvDCF_accuracy.yml:interval=1(every second batch), and the tracks feed real-time messages (focused to cars and with a lot of objects).Each setting is in a shipped preset, but no preset uses both, and the overflow appears only when they are combined:
develop)IOUNvDCF_perf,NvDCF_max_perfNvDCF_accuracyNvSORT,NvDeepSORTHow it showed up for us: random glibc heap aborts (
double free or corruption,free(): invalid pointer) and SIGSEGVs, minutes after start, in places unrelated to the tracker, on several Jetsons. Valgrind on the standalone repro pointed to theP(7,7)store.Our workaround: we currently run DS 7.1 with a binary patch that skips that store when the filter has fewer than 8 states. To check it, we ran our full 4-camera pipeline on recorded video from one of our sites, 12 times without and 12 times with the patch. Each run started the pipeline, streamed for one minute and stopped, with glibc heap checks on (
MALLOC_CHECK_=3,libc_malloc_debug) so corruption fails fast:The patch doesn't change normal tracking: in the repro, the patched library's output matches the stock one exactly until the first trajectory projection.
About the PR: pull requests on this repository are limited to collaborators, so I can't open one from my fork. The branch is rebased on the current
develop(dfcc4e7) and follows the guidelines (Conventional Commit, signed off):Could you enable PRs for me, or apply the commit directly?
On validation: I tested the fix with the attached repro under valgrind and in our 4-camera pipeline, on the DS 7.1 library. I have not run
build.sh --packageon 9.2, since I have to setup a new machine with JetPack 7 or x86 dGPU machine. Note that the source4 sanity test would not exercise this bug: its tracker config does not enable re-association together with dynamic noise. The attached repro withconfig_repro.ymlis the test that reaches the faulty line.