[PR #2030] [CLOSED] Fix Dish Network caption out-of-bounds panics in userdata.rs #2833

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/2030
Author: @THE-Amrit-mahto-05
Created: 1/17/2026
Status: Closed

Base: masterHead: fix/rust-dish-caption-oob


📝 Commits (1)

  • 926c232 Fix Dish Network caption out-of-bounds panics in userdata.rs

📊 Changes

1 file changed (+18 additions, -2 deletions)

View changed files

📝 src/rust/src/es/userdata.rs (+18 -2)

📄 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.

Description

Prevents critical crashes when processing malformed or truncated Dish Network caption streams.
Previously, the code performed unchecked slicing based on pattern_type, which could panic if insufficient data was available.

The old comment “4 to 6 bytes” was outdated. Based on the actual patterns, the required range is now 4 to 12 bytes.

This fix ensures the decoder continues gracefully with subsequent packets without crashing.

Fix

  • Added a single bounds check before the match pattern_type block.
  • Determine the number of bytes required for each pattern:
    • Pattern 0x02 → 4 bytes
    • Pattern 0x04 → 5 bytes
    • Pattern 0x05 → 12 bytes (accesses indices 0–11)
  • If insufficient data is available:
    • Log a message indicating the insufficient bytes
    • Return early with Ok(1) to skip the malformed packet
  • Updated the slice for pattern 0x05 from 10 → 12 bytes to safely access all required indices.

Returning Ok(1) skips malformed packets while preserving decoder stability, and all valid packets continue processing as before.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/2030 **Author:** [@THE-Amrit-mahto-05](https://github.com/THE-Amrit-mahto-05) **Created:** 1/17/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/rust-dish-caption-oob` --- ### 📝 Commits (1) - [`926c232`](https://github.com/CCExtractor/ccextractor/commit/926c232e14e25680eeda5089003c00d61527c1de) Fix Dish Network caption out-of-bounds panics in userdata.rs ### 📊 Changes **1 file changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/rust/src/es/userdata.rs` (+18 -2) </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. - [x] **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. - [ ] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [x] I am an active contributor to CCExtractor. --- ### Description Prevents critical crashes when processing malformed or truncated Dish Network caption streams. Previously, the code performed unchecked slicing based on pattern_type, which could panic if insufficient data was available. The old comment “4 to 6 bytes” was outdated. Based on the actual patterns, the required range is now 4 to 12 bytes. This fix ensures the decoder continues gracefully with subsequent packets without crashing. ### Fix - Added a single bounds check before the match pattern_type block. - Determine the number of bytes required for each pattern: - Pattern 0x02 → 4 bytes - Pattern 0x04 → 5 bytes - Pattern 0x05 → 12 bytes (accesses indices 0–11) - If insufficient data is available: - Log a message indicating the insufficient bytes - Return early with Ok(1) to skip the malformed packet - Updated the slice for pattern 0x05 from 10 → 12 bytes to safely access all required indices. Returning Ok(1) skips malformed packets while preserving decoder stability, and all valid packets continue processing as before. --- <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:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2833