Skip to content

bug: encoder: ASan heap-buffer-overflow in local test_encoding_lag_rescale #3788

Closed

Description

@zackees

Location

libobs/obs-encoder.c.h:1720, do_encode: ept->pts = frame->pts, following da_push_back_new(encoder->encoder_packet_times).

Class

ASan heap-buffer-overflow, write of 8 bytes, 8 bytes before a 2592-byte allocation, in existing test_encoding_lag_rescale.

How it is reached

The existing local C characterization test creates its own dummy encoder/output and local canvases. Its encode callback sleeps optionally and returns no packet; it has no network input. This report concerns that trusted-local test lifecycle (low risk under SECURITY.md); no hostile input/reachability claim is made.

Observed on unrelated DeckLink compile-policy PR #3787, head 1aa14446307f51e1d573cebd6e1ab06f2d95ea6b, based on master ef696e998. Changed files are only the DeckLink private enum/default return, CMake warning opt-in and Python compile regression; no encoder, container, or existing C test changes. Hosted Format/Fast Gate and conversion replay pass.

Run: https://github.com/obs-rust/obs-studio/actions/runs/42315858830/job/128228529606
Download sanitize-asan, inspect tests/test_encoding_lag_rescale.log and tests/test_encoding_lag_rescale.asan.25496 for the complete report. Summary: 707/708 tests clean, one known excluded test; this test is the sole counted failure. Graphics unloaded-library init leaks are explicitly external/not counted.

Stack: do_encode:1720 → receive_video:1837 → obs_media_io::ffi::video_io::LibobsHost::deliver → video_output::thread_main. Allocation is on the same T12 in bmalloc reached through receive_video.

Proposed fix and failing test

Investigate encoder packet-time array append/reset synchronization during force-stop/release versus the video delivery thread; obs_encoder_stop resets encoder_packet_times.num while do_encode appends. This is a hypothesis, not a diagnosed cause. Preserve the existing C test. Reproduce it under the ASan harness, then add focused coverage in the existing category if a race is confirmed; fix the lifecycle/synchronization and show the same test clean. Do not suppress it or add a known-list entry to land #3787.

Per docs/knowledge/asan-pr-failure.md, the unrelated failing job will be retried once after filing this report; no repeated reruns to obtain a pass.

Activity

  1. added
    bug
    on Nov 7, 2026
  2. zackees commented on Nov 7, 2026

    @zackees
    MemberAuthor

    Claiming: #3788

    Plan, one PR:

    1. RED: new focused cmocka test that stops an output while the video thread is inside the encoder's encode callback, and shows the stop changing the packet-times array from another thread. Existing C tests stay untouched.
    2. GREEN: fix the array's lifecycle in libobs/obs-encoder.c.h so it is never written while the encoder can still be delivering, then loop the test under ASan.

    First PR expected today. Not a remote path: reached only through local encoder start and stop.

  3. added
    ready
    on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions