Skip to content

[BUG] nvmultiobjecttracker: heap overflow in SimpleEstimator2::initStates (P(7,7) on the 6-state trajectory projector) with enableReAssoc + dynamic noise #121

Open

Description

@TheGoncaloSilva

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 bounds

Eigen 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: 0

Steps:

unzip nvmot-repro.zip && cd repro && ./run.sh

Results:

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:

 			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-multiarch
    • docker build -t nvmot-repro:7.1 . (stock image + valgrind, see attached Dockerfile)
    • 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 the develop source)

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

  1. added
    bug
    on Nov 15, 2026
  2. added a commit that references this issue on Nov 15, 2026
    53ed613
  3. kevinsongbing commented on Nov 17, 2026

    @kevinsongbing
    Collaborator

    Seems reasonable, we will check and feedback later.

  4. kevinsongbing commented on Nov 18, 2026

    @kevinsongbing
    Collaborator

    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.

  5. added a commit that references this issue on Nov 18, 2026
    b6e63ae
  6. TheGoncaloSilva commented on Nov 18, 2026

    @TheGoncaloSilva
    Author

    Thanks for the suggestion. Some context on our setup and why we don't use config_tracker_NvDCF_accuracy.yml:

    • Setup: Each Jetson Orin Nano Super (DS 7.1, JetPack 6.2) runs four 1080p cameras at 11 fps, with the detector at interval=1 (every second batch), and the tracks feed real-time messages (focused to cars and with a lot of objects).
    • No visual tracker or Re-ID inside the tracker: the GPU is already 70–80% busy. When we tried in-tracker Re-ID, tracker time went from ~12 ms to ~105 ms per batch, and the pipeline fell behind. We run a motion-only profile and do Re-ID separately, because another service does the cross-camera fusion.
    • Dynamic noise (NvSORT estimator): with only ~5.5 detector passes per second (and interval of 1), close vehicles move a lot between passes, and height-scaled noise predicts them better.
    • Re-association: vehicles are often hidden for 1–2 s behind buses and traffic signs, and without it they come back with a new ID.

    Each setting is in a shipped preset, but no preset uses both, and the overflow appears only when they are combined:

    Preset (develop) Re-association Kalman noise
    IOU off no estimator
    NvDCF_perf, NvDCF_max_perf off constant
    NvDCF_accuracy on constant
    NvSORT, NvDeepSORT off dynamic
    Ours (motion-only) on dynamic

    How 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 the P(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:

    Crashes while starting or streaming Crashes on shutdown Clean runs
    Stock DS 7.1 7 3 2
    With the patch 0 0 11 (1 stopped by our own shutdown watchdog, no heap error)

    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 --package on 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 with config_repro.yml is the test that reaches the faulty line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions