Adding Additional Tests for SCTE-35 Parser for robustness#10
Merged
theRealRobG merged 2 commits intotheRealRobG:mainfrom Jul 11, 2025
Merged
Adding Additional Tests for SCTE-35 Parser for robustness#10theRealRobG merged 2 commits intotheRealRobG:mainfrom
theRealRobG merged 2 commits intotheRealRobG:mainfrom
Conversation
theRealRobG
reviewed
Jul 10, 2025
Owner
theRealRobG
left a comment
There was a problem hiding this comment.
Looks good, thanks for the addition!
I left 2 comments; the first I already indicated is not anything to act on (I'm fine not validating the error case thrown), but I think a comment should be added for the fuzz test against fatal crashes... What do you think?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds and documents additional tests targeting SCTE-35 parser robustness, focusing on error handling for malformed, truncated, or otherwise invalid input.
Requires @theRealRobG review & approval to validate the hexes and to see if the errors thrown in each test is expected.
1.
test_invalidHexInISANShouldThrowIntent:
Ensure the parser rejects hex strings with non-hexadecimal characters (malformed input).
Description:
Tests that passing a hex string with an invalid character (
'Z') in the ISAN field results in a thrown error, confirming the parser correctly validates input format.Hex Construction:
The test hex string is a valid SCTE-35 message except for a single non-hex character (
Z) embedded in the ISAN field. This simulates a corrupt or malformed input.Error Thrown:
2.
test_randomNoiseInput_shouldNotCrashIntent:
Ensure parser robustness against random or malformed input.
Description:
Fuzzes the parser with 100 random base64-encoded data blobs of varying lengths and asserts that the parser never crashes (it may throw errors, which is acceptable).
Hex Construction:
The test data is not a crafted SCTE-35 hex string at all. Instead, it generates random bytes, encodes them as base64, and attempts to parse them as if they were a valid SCTE-35 message.
Error Thrown:
No crashes; errors may be thrown but are expected.
3.
test_descriptorLengthTooShort_throwsErrorIntent:
Detect under-declared descriptor lengths.
Description:
Checks that if the descriptor length field declares more data than is actually present for the descriptor, the parser throws an error (truncated or incomplete descriptor).
Hex Construction:
The descriptor length field (immediately after the descriptor tag) is set to a value (
0A, or 10 bytes) larger than the number of bytes actually present in the descriptor payload (only 6 bytes provided after the length field). The hex string is cut short to simulate truncation.Error Thrown:
4.
test_descriptorLengthTooLong_throwsErrorIntent:
Detect over-declared descriptor loop lengths (buffer overrun).
Description:
Verifies that if the descriptor loop length field declares more bytes than are available, the parser throws an error (unexpected end of data or overrun).
Hex Construction:
The descriptor loop length field (in the SCTE-35 section header) is set to a value (
20, or 32 bytes) that is larger than the actual number of bytes available for all descriptors combined. The message is not padded to match, so the parser will run out of data when trying to read descriptors.Error Thrown:
5.
test_unknownCommandAndDescriptorIDsIntent:
Ensure errors are thrown for unknown/reserved command, descriptor, and type IDs.
Description:
Tests that the parser throws errors when encountering:
verifying that reserved or invalid identifier values are flagged as errors.
Hex Construction:
splice_command_typebyte is set toFF(an undefined value).FF(not a defined descriptor type).FF(not a valid type).Errors Thrown: