Skip to content

Handle truncated TLV values as recoverable diagnostics#12

Closed
SoorajDe wants to merge 2 commits into
jmestwa-coder:mainfrom
SoorajDe:tlv-truncated-diagnostic
Closed

Handle truncated TLV values as recoverable diagnostics#12
SoorajDe wants to merge 2 commits into
jmestwa-coder:mainfrom
SoorajDe:tlv-truncated-diagnostic

Conversation

@SoorajDe

Copy link
Copy Markdown
Contributor

Changes made:

  • Added recoverable truncation handling in sigflow/parsers/tlv.py
  • If a TLV declares a value length larger than the remaining buffer, the parser now emits:
    context.warn("tlv-truncated", ...)
    and stops parsing gracefully instead of raising ParseError("truncated input")

Tests:

  • Added test_tlv_truncated_value_is_recoverable
  • Verified no exception is raised for truncated TLV value payloads
  • Verified tlv-truncated diagnostic is emitted

Verification:

  • python -m pytest -q
  • 12 passed

@jmestwa-coder

Copy link
Copy Markdown
Owner

This PR is related to issues #4

@jmestwa-coder

Copy link
Copy Markdown
Owner

@SoorajDe
The TLV truncation handling changes themselves look much more reasonable now after narrowing the exact parser boundary and recovery behavior. However, I’m not comfortable merging this PR as-is because it currently combines multiple unrelated behavioral changes in a single review scope.

I’d prefer to keep the review focused specifically on the TLV truncation recovery path and its associated regression coverage before considering the other changes.

@SoorajDe SoorajDe closed this May 26, 2026
@jmestwa-coder

Copy link
Copy Markdown
Owner

@SoorajDe why did you close this PR .?

@SoorajDe

SoorajDe commented May 26, 2026 via email

Copy link
Copy Markdown
Contributor Author

@jmestwa-coder

Copy link
Copy Markdown
Owner

@SoorajDe you can make the changes locally and push them with a new commit, or amend the previous commit and force-push to update the PR.

@SoorajDe

SoorajDe commented May 26, 2026 via email

Copy link
Copy Markdown
Contributor Author

@jmestwa-coder jmestwa-coder linked an issue May 26, 2026 that may be closed by this pull request
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.

TLV file crash

2 participants