Skip to content

fix(flv): reset tag structs at parse start to avoid stale fields#91

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/bug-scanning-automation-8aef
Draft

fix(flv): reset tag structs at parse start to avoid stale fields#91
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/bug-scanning-automation-8aef

Conversation

@cursor

@cursor cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Bug scan: flv module (2026-07-10)

Bug

All three FLV parse() functions (audio_tag, video_tag, script_tag) reused caller-owned tag structs without clearing prior fields.

Impact

  • script_tag: Shorter script name after longer one left stale suffix (e.g. "hi" after "onMetaData""hiataData" as C string).
  • video_tag: H264 then VP6 left stale avc_packet_type / composition_time — wrong mux timing.
  • audio_tag: AAC then MP3 left stale aac_packet_type.
  • Failed parses (empty payload, unknown codec) could leave a mix of old and new fields.

Fix

Reset *tag = Tag::default() at the start of each parse().

Validation

cargo test --no-default-features flv:: — 16 tests pass, including new regression tests for struct reuse and error paths.

Open in Web View Automation 

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Reusing AudioTag/VideoTag/ScriptTag across parse() calls left codec-specific
fields (avc_packet_type, composition_time, aac_packet_type) and script name
suffixes from prior payloads. Failed parses could also mix old and new state.

Reset *tag = Default::default() at the start of each parse() and add regression
tests for struct reuse and error paths.

Co-authored-by: Alexander Wagner <info@alexanderwagnerdev.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 76ffd650-802d-442a-8f69-c198377b3583

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/bug-scanning-automation-8aef

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant