Skip to content

fit: compressed-timestamp records get the overrun check too - #105

Merged
abdulsaheel merged 1 commit into
mainfrom
fix/fit-compressed-overrun
Dec 5, 2026
Merged

abdulsaheel merged 1 commit into
mainfrom
fix/fit-compressed-overrun

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

compressed records skipped the i > end check, so a truncated file decoded the last one from the crc bytes. same check now.

Summary by Sourcery

Apply the data-overrun check to compressed-timestamp FIT records.

Bug Fixes:

  • Reject compressed-timestamp FIT records that extend past the data section instead of parsing trailing CRC bytes as record data.

Tests:

  • Add regression coverage for an overrun in a compressed record.

Summary by CodeRabbit

  • Bug Fixes
    • FIT files with compressed records extending beyond the declared data section are now rejected with a format error.

@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Apply the data-boundary overrun check to compressed-timestamp records before continuing parsing.

  • lib/src/garmin_fit.dart L178

Tests

Add a regression test confirming a compressed record that overruns the data is rejected.

  • test/garmin_fit_test.dart L116-124

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

parseFit now rejects compressed-timestamp records that extend past the declared FIT data end. A test verifies that this case throws a FormatException.

Changes: FIT record bounds

Layer / File(s) Summary
Compressed-record bounds check
lib/src/garmin_fit.dart, test/garmin_fit_test.dart
parseFit checks the next record position after decoding a compressed-timestamp record. The test verifies that an overrun throws a FormatException.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: Minimal · up to 973d4

Compressed-timestamp records that extend past the declared FIT data end are now rejected with a FormatException instead of being decoded from CRC bytes. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: the existing overrun check now also applies to compressed-timestamp records in the FIT parser. The raw summary confirms parseFit now throws FormatException('FIT: record ove…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: the existing overrun check now also applies to compressed-timestamp records in the FIT parser. The raw summary confirms parseFit now throws FormatException('FIT: record overruns data') for compressed-timestamp records, and a test covers this. The title is specific, short, and matches the main change.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ea19cb85-6248-41e8-95f0-683af5d1609f
Commits

Reviewing files that changed from the base of the PR and between bbd2df0 and 973d43d.

Files selected for processing: 2

  • lib/src/garmin_fit.dart
  • test/garmin_fit_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@abdulsaheel
abdulsaheel merged commit e1d90e8 into main Dec 5, 2026
4 checks passed
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