Fix `IndexError` in `GitConfigParser` When a Quoted Config Value Contains a Trailing New Line by DaveLak · Pull Request #1908 · gitpython-developers/GitPython
8 changes: 2 additions & 6 deletions
fuzzing/fuzz-targets/fuzz_config.py
2 changes: 1 addition & 1 deletion
git/config.py
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -452,7 +452,7 @@ def _read(self, fp: Union[BufferedReader, IO[bytes]], fpname: str) -> None: | |
| e = None # None, or an exception. | ||
|
|
||
| def string_decode(v: str) -> str: | ||
| if v[-1] == "\\": | ||
| if v and v.endswith("\\"): | ||
This comment was marked as resolved.Member Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, for some reason I didn't see that comment! That addresses this proactively and my above comment can be disregarded entirely. If the code is modified further in the future then the Member Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, I tried to enable branch protections which should enable auto-merge, and thus resolve the issue with long-running CI sometimes preventing a merge in addition to me forgetting to do it later. It didn't yet work for this PR, but I will see for the next one. |
||
| v = v[:-1] | ||
| # END cut trailing escapes to prevent decode error | ||
|
|
||
|
|
||
8 changes: 8 additions & 0 deletions
test/test_config.py