Repository navigation
[FIX] Reject malformed credits time options instead of aborting - #2386
Merged
Merged
Conversation
--startat, --endat and the start/end credits timing options called stringztoms(...).unwrap(), so a value such as "abc" panicked inside ccxr_parse_parameters. A panic cannot unwind through the extern "C" boundary, so the process aborted with SIGABRT (exit 134) and no explanation. Report the value with ExitCause::MalformedParameter like the other malformed parameters do.
CCExtractor#2374 already validates --startat and --endat in clap. Do the same for the six start/end credits timing options and drop the helper this branch added.
Collaborator
CCExtractor CI platform finished running the test files on linux. 106/237 tests matched the approved output:
131 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 9672, commit 429de8b:
Fail on both but produce different output — behaviour moved even though the verdict did not:
Fail there, pass here:
Compared with the commit this branch was cut from — test 9678, commit 13d3372:
Fail on both but produce different output — behaviour moved even though the verdict did not:
Fail there, pass here:
This branch changes the behaviour of 13 test(s) relative to the tip of master. Those are the ones worth looking at; anything else in the list fails the same way on both sides. |
5 of 7 tasks
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.
Problem
The six start/end credits timing options (
--startcreditsnotbefore,--startcreditsnotafter,--startcreditsforatleast,--startcreditsforatmost,--endcreditsforatleast,--endcreditsforatmost) calledstringztoms(...).unwrap(). A bad value panicked insideccxr_parse_parameters, which isextern "C", so the panic could not unwind and the process aborted (exit 134, SIGABRT) with no explanation.#2374 fixed this for
--startatand--endatby validating the value in clap. This PR does the same for the credits options, so all eight time options behave the same way.Fix
The six
Argsfields becomeOption<Timestamp>withvalue_parser=Timestamp::parse_optional_hhmmss_from_str, likestartat/endat.parse_parametersthen copies the parsed value, with nounwrap().Testing
test_credits_time_rejects_invalid_values: all six options reject"",invalid,60,00:60,1::2and1:2:3:4as clap value-validation errors naming the option.test_credits_time_formats: all six acceptS,MM:SSandHH:MM:SSand set the rightenc_cfgfields.cargo test: 418 passed.cargo fmt --checkis clean.mac/build.commandand ran each option withabc(clap error, no panic). A valid--startcreditsforatmost 2 --endcreditsforatmost 3still exits 0.