[PR #2061] [CLOSED] [FIX] Guard against NULL timing context when reporting decoder statistics #2873

Open
opened 2026-01-29 17:24:22 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/2061
Author: @hridyasadanand
Created: 1/24/2026
Status: Closed

Base: masterHead: guard-null-timing-report


📝 Commits (2)

  • 9f344ee Guard against NULL timing context in decoder reporting
  • 6d2f58e Remove workflows to allow fork push

📊 Changes

15 files changed (+3 additions, -1825 deletions)

View changed files

.github/workflows/build_appimage.yml (+0 -157)
.github/workflows/build_deb.yml (+0 -283)
.github/workflows/build_deb_debian13.yml (+0 -275)
.github/workflows/build_docker.yml (+0 -96)
.github/workflows/build_linux.yml (+0 -117)
.github/workflows/build_linux_systemlibs.yml (+0 -154)
.github/workflows/build_mac.yml (+0 -177)
.github/workflows/build_windows.yml (+0 -142)
.github/workflows/format.yml (+0 -57)
.github/workflows/homebrew.yml (+0 -15)
.github/workflows/publish_chocolatey.yml (+0 -136)
.github/workflows/publish_winget.yml (+0 -38)
.github/workflows/release.yml (+0 -137)
.github/workflows/test_rust.yml (+0 -41)
📝 src/ccextractor.c (+3 -0)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Summary

This PR adds a defensive NULL check for dec_ctx->timing in the decoder reporting loop at the end of start_ccx().

Under certain execution paths, decoder contexts present in ctx->dec_ctx_head may not have an associated timing context. The current code unconditionally dereferences dec_ctx->timing, which can lead to undefined behavior or crashes.

This change safely skips such decoder entries during reporting.

Problem Description

The reporting loop in start_ccx() assumes that every decoder in ctx->dec_ctx_head has a valid timing structure and unconditionally accesses timing fields.

While decoders created via init_cc_decode() always initialize timing, decoder contexts created via copy_decoder_context() explicitly set timing = NULL. These copied decoder contexts may still be present in dec_ctx_head.

As a result, dec_ctx->timing is not guaranteed to be non-NULL at this point.

Fix

Add a simple guard before accessing timing fields:

if (!dec_ctx->timing)
    continue;


---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/2061 **Author:** [@hridyasadanand](https://github.com/hridyasadanand) **Created:** 1/24/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `guard-null-timing-report` --- ### 📝 Commits (2) - [`9f344ee`](https://github.com/CCExtractor/ccextractor/commit/9f344eea2420ab3e039e6c1ff2e47a496d27bfd7) Guard against NULL timing context in decoder reporting - [`6d2f58e`](https://github.com/CCExtractor/ccextractor/commit/6d2f58e4afd85d44e1b89f1b96f91d3a4ab396c1) Remove workflows to allow fork push ### 📊 Changes **15 files changed** (+3 additions, -1825 deletions) <details> <summary>View changed files</summary> ➖ `.github/workflows/build_appimage.yml` (+0 -157) ➖ `.github/workflows/build_deb.yml` (+0 -283) ➖ `.github/workflows/build_deb_debian13.yml` (+0 -275) ➖ `.github/workflows/build_docker.yml` (+0 -96) ➖ `.github/workflows/build_linux.yml` (+0 -117) ➖ `.github/workflows/build_linux_systemlibs.yml` (+0 -154) ➖ `.github/workflows/build_mac.yml` (+0 -177) ➖ `.github/workflows/build_windows.yml` (+0 -142) ➖ `.github/workflows/format.yml` (+0 -57) ➖ `.github/workflows/homebrew.yml` (+0 -15) ➖ `.github/workflows/publish_chocolatey.yml` (+0 -136) ➖ `.github/workflows/publish_winget.yml` (+0 -38) ➖ `.github/workflows/release.yml` (+0 -137) ➖ `.github/workflows/test_rust.yml` (+0 -41) 📝 `src/ccextractor.c` (+3 -0) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [ ] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [x] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. --- ### Summary This PR adds a defensive NULL check for `dec_ctx->timing` in the decoder reporting loop at the end of `start_ccx()`. Under certain execution paths, decoder contexts present in `ctx->dec_ctx_head` may not have an associated timing context. The current code unconditionally dereferences `dec_ctx->timing`, which can lead to undefined behavior or crashes. This change safely skips such decoder entries during reporting. ### Problem Description The reporting loop in `start_ccx()` assumes that every decoder in `ctx->dec_ctx_head` has a valid timing structure and unconditionally accesses timing fields. While decoders created via `init_cc_decode()` always initialize timing, decoder contexts created via `copy_decoder_context()` explicitly set `timing = NULL`. These copied decoder contexts may still be present in `dec_ctx_head`. As a result, `dec_ctx->timing` is not guaranteed to be non-NULL at this point. ### Fix Add a simple guard before accessing timing fields: ```c if (!dec_ctx->timing) continue; --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:24:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2873