Fix panic on truncated strftime padding modifier#782
Open
SAY-5 wants to merge 1 commit into
Open
Conversation
…modifier Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #782 +/- ##
=======================================
+ Coverage 88.2% 88.3% +0.1%
=======================================
Files 99 99
Lines 13030 13037 +7
=======================================
+ Hits 11494 11510 +16
+ Misses 1536 1527 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #781.
When a strftime format string ends right after a padding modifier (
%_,%-,%0), the tokenizer readsself.input[2]for the component byte without checking that it exists, soparse_strftime_borrowed("%_")panics with an index-out-of-bounds instead of returning an error. This splits the padding match out and usesget(2)so a missing component yields the sameExpectederror the parser already returns elsewhere.