git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/5] diff --color-moved-ws: fix double free crash

From
PWPhillip Wood <phillip.wood@talktalk.net>
Date
Oct 3, 2018, 09:38 UTC
Message-ID
<1c6b26a2-45ca-df76-8baa-61790cb963ac@talktalk.net>
In-Reply-To
<CAGZ79kYqACgoNShaPBQQSUN1B_dhmdxHxBV6YZoNAd39f6XMjw@mail.gmail.com>
Hi Stefan
Thanks for looking at these patches
On 02/10/2018 19:49, Stefan Beller wrote:
Show 28 quoted lines
> On Tue, Oct 2, 2018 at 10:55 AM Phillip Wood <phillip.wood@talktalk.net> wrote:
> 
>> The solution is to store the ws_delta in the array of potential moved
>> blocks rather than with the lines. This means that it no longer needs
>> to be copied around and one block cannot overwrite the ws_delta of
>> another. Additionally it saves some malloc/free calls as we don't keep
>> allocating and freeing ws_deltas.
> 
> Another solution would be to duplicate the copy-arounds, that it only
> fixes the double free, but having another layer of abstraction
> (moved block vs line) makes sense as then we don't need to copy
> it forward.
> 
> With this patch applied the diff as mentioned works and having the
> ws deltas with the blocks instead of the
> 
>>
>> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> 
> 
> 
>>  static void pmb_advance_or_null_multi_match(struct diff_options *o,
> [...]
>>         for (i = 0; i < pmb_nr; i++) {
>>                 if (got_match[i]) {
>>                         /* Carry the white space delta forward */
> 
> I would think this comment is obsolete as well with this patch?

Yes you're right I should have removed that. As there are some changes needed to some other comments I'll re-roll

Best Wishes
Phillip
> 
> With or without that nit addressed, this patch is
> Reviewed-by: Stefan Beller <sbeller@google.com>
> 
Previous: Stefan BellerNext: Phillip Wood
Message 14 of 21 in “diff --color-moved-ws: fix double free crash”
  1. 1/5 diff --color-moved-ws: fix double free crashPhillip Wood, Oct 2, 2018
  2. 2/5 diff --color-moved-ws: fix out of bounds string accessPhillip Wood, Oct 2, 2018
  3. Stefan BellerOct 2, 2018
  4. Phillip WoodOct 3, 2018
  5. 3/5 diff --color-moved-ws: fix a memory leakPhillip Wood, Oct 2, 2018
  6. Stefan BellerOct 2, 2018
  7. Phillip WoodOct 3, 2018
  8. Martin ÅgrenOct 3, 2018
  9. 4/5 diff --color-moved-ws: fix another memory leakPhillip Wood, Oct 2, 2018
  10. Stefan BellerOct 2, 2018
  11. 5/5 diff --color-moved: fix a memory leakPhillip Wood, Oct 2, 2018
  12. Stefan BellerOct 2, 2018
  13. Stefan BellerOct 2, 2018
  14. Phillip WoodOct 3, 2018
  15. 0/5 diff --color-moved-ws: fix double free crashPhillip Wood, Oct 4, 2018
  16. 2/5 diff --color-moved-ws: fix out of bounds string accessPhillip Wood, Oct 4, 2018
  17. 3/5 diff --color-moved-ws: fix a memory leakPhillip Wood, Oct 4, 2018
  18. 5/5 diff --color-moved: fix a memory leakPhillip Wood, Oct 4, 2018
  19. Stefan BellerOct 4, 2018
  20. 4/5 diff --color-moved-ws: fix another memory leakPhillip Wood, Oct 4, 2018
  21. 1/5 diff --color-moved-ws: fix double free crashPhillip Wood, Oct 4, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.