Re: [PATCH] git tag --contains : avoid stack overflow
- From
Pat Thoyts <patthoyts@gmail.com>
- Date
- Nov 10, 2012, 21:33 UTC
- Message-ID
- <CABNJ2G+hnCgs9u64c83s+2fnVyp584e4PPX7F6BF34T1ieDrhA@mail.gmail.com>
- In-Reply-To
- <d9843c09-3ca9-406e-9df8-78603235d985@googlegroups.com>
On 10 November 2012 21:13, Jean-Jacques Lafay <jeanjacques.lafay@gmail.com> wrote:
Show 40 quoted lines
> Le samedi 10 novembre 2012 21:00:10 UTC+1, Philip Oakley a écrit : >> >> From: "Jean-Jacques Lafay" <jeanjacq...@gmail.com> Sent: Saturday, >> November 10, 2012 5:36 PM >> > In large repos, the recursion implementation of contains(commit, >> > commit_list) >> > may result in a stack overflow. Replace the recursion with a loop to >> > fix it. >> > >> > Signed-off-by: Jean-Jacques Lafay <jeanjacq...@gmail.com> >> >> This is a change to the main git code so it is better to submit it to >> the main git list at g...@vger.kernel.org (plain text, no HTML, first >> post usually has a delay ;-) >> >> It sounds reasonable but others may have opinions and comments. >> >> Have you actually suffered from the stack overflow issue? You only >> suggest it as a possibility, rather than a real problem. >> >> Philip > > > Yes, it actually crashed on me, and since the call is made by GitExtension > while browsing the commit history, it was quickly annoying to have windows > popping a "git.exe stopped working" message box at my face every time I > clicked on a line of the history ;-) (well, you can sort of work around it > by having the "file tree" or "diff" tab active) > > Coincidentally, as I was having a glance at the recent topics, I saw that > someone else experienced it. > > However, I couldn't reproduce it on Linux : where the windows > implementations crashes at a ~32000 depth (*not* exactly 32768, mind you), > on linux it happily went through 100000 commits. I didn't take time to look > much further, but maybe on my 64 bit Linux VM, the process can afford to > reserve a much bigger address range for the stack of each thread than the > 1Mb given to 32 bit processes on windows. > > Jean-Jacques.
I checked this on msysGit - the test causes a crash on Windows when using the 1.8.0 release and recompiling with this patch applied fixes this. As mentioned, its best to have this reviewed upstream too as its likely that windows just has a smaller stack so causes the crash earlier.
-- *** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to msysgit@googlegroups.com To unsubscribe from this group, send email to msysgit+unsubscribe@googlegroups.com For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en