Skip to content

fast-import input string handling bugs

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fast-import: duplicate parsed encoding stringfast-import.c t/t9300-fast-import.sh+10 -22 replies
2/2fast-import: duplicate into history rather than passing ownershipfast-import.c t/t9300-fast-import.sh+1 -83 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] fast-import input string handling bugs
Quoted 4 lines · Jeff King

And I think this is actually a real bug in the current code! We keep a pointer to the encoding string, which survives because of the history. But that history is bounded, and we could have an indefinite number of changed files in the middle. If I modify t9300 like this:

Here are two patches. The first fixes the existing bug with "encoding", and the second uses the approach I suggested to fix the leak you noticed.

The second one does carry a greater risk of regression than your patch, but I think it's worth it for the fact that it makes any other bugs (like the "encoding" one) more obvious.

[1/2]: fast-import: duplicate parsed encoding string
[2/2]: fast-import: duplicate into history rather than passing ownership

 fast-import.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-Peff