git: reject malformed conflict labels - #9897
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Can you please put the PR description into the commit description to adhere to the project commit guidelines. Thanks. |
d0ab457 to
f9d7707
Compare
|
Updated in f9d7707. The commit description now contains the PR summary, root cause, and local checks. |
martinvonz
left a comment
There was a problem hiding this comment.
Thanks.
From commit description:
- cargo test -p jj-lib --test runner test_invalid_conflict_labels_header -- --exact
- cargo +stable clippy -p jj-lib --test runner -- -D warnings
- cargo +nightly fmt --all -- --check
FYI, we run all that on CI (and all tests, of course), so there's no need to include the commit description. Any manual tests you ran could be useful, however, but there's no expectations that you run manual tests.
Out of curiosity, did you run into that crash in practice? If so, do you know how the bad header ended up in the commit?
626ae3e to
b5e6b9a
Compare
Reject malformed jj:conflict-labels headers instead of panicking while importing or reading Git commits. The header is decoded as UTF-8 and converted to Merge, which requires an odd number of terms. Reject an invalid UTF-8 header or an even number of labels before constructing the merge.
b5e6b9a to
0015549
Compare
|
Addressed in 0015549.
This is defensive hardening. I do not have a concrete crash report or provenance for a malformed header to add. |
Summary
jj:conflict-labelscommit headers instead of panicking while importing or reading Git commits.Root cause
The header was decoded as UTF-8 and passed directly to
Merge, which assumes an odd number of terms. A malformed Git commit could violate those assumptions and abortjj.Tests
cargo test -p jj-lib --test runner test_invalid_conflict_labels_header -- --exactcargo +stable clippy -p jj-lib --test runner -- -D warningscargo +nightly fmt --all -- --check