Skip to contentSkip to conversation

SEGV in git-apply

PATCH In review Martin Waitz 3 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

hoi :)

I just hit this bug in git-apply, while executing it in a subdirectory. At the moment I am using some mixture of next and some own changes (mostly submodule support, should not affect this bug).

I am afraid that I don't have the time to fix it myself atm, so I am simply attaching the backtrace here:

Program received signal SIGSEGV, Segmentation fault.
0x080500fa in apply_patch (fd=5, filename=0xbf821b4d "/tmp/404241.patch",
inaccurate_eof=<value optimized out>) at builtin-apply.c:2504
2504 if (pathlen <= prefix_length ||
(gdb) bt
#0 0x080500fa in apply_patch (fd=5, filename=0xbf821b4d "/tmp/404241.patch",
inaccurate_eof=<value optimized out>) at builtin-apply.c:2504
#1 0x0805147a in cmd_apply (argc=3, argv=0xbf8201e4, prefix=0x80e75c6 "src/")

    at builtin-apply.c:2719

#2 0x0804ab55 in handle_internal_command (argc=3, argv=0xbf8201e4,
envp=<value optimized out>) at git.c:304
#3 0x0804b1f8 in main (argc=3, argv=Cannot access memory at address 0x8 ) at git.c:341

Signature · 1 line
Martin Waitz
#1 lore raw

Hi,

Quoted 4 lines · Martin Waitz

Program received signal SIGSEGV, Segmentation fault. 0x080500fa in apply_patch (fd=5, filename=0xbf821b4d "/tmp/404241.patch",
inaccurate_eof=<value optimized out>) at builtin-apply.c:2504
2504 if (pathlen <= prefix_length ||

It seems that the culprit is not this line (you have an optimized binary, so that is expected).

My guess is that your patch does not contain a new name, neither an old name.

It could also be that the filename has length 0.

But without that patch I cannot tell.

Ciao,
Dscho

#2 lore raw

hoi :)

Quoted 1 line · Johannes Schindelin

But without that patch I cannot tell.

patch was this one:

------------------ 8< -------------------------------

callbacks.cc +3 -4
@@ -12890,12 +12890,11 @@ void on_unknown_edit_optionmenu_sign_cha
 	}
 }
 
-gboolean on_key_press_event(GtkWidget*, GdkEventKey *event, gpointer) {
+gboolean on_key_press_event(GtkWidget *o, GdkEventKey *event, gpointer) {
 	if(!GTK_WIDGET_HAS_FOCUS(expression) && (event->keyval > GDK_Hyper_R || event->keyval < GDK_Shift_L)) {
-		bool return_val = FALSE;
 		GtkWidget *w = gtk_window_get_focus(GTK_WINDOW(glade_xml_get_widget (main_glade, "main_window")));
-		if(w) g_signal_emit_by_name((gpointer) w, "key_press_event", event, &return_val);
-		if(return_val) return TRUE;
+		if(gtk_bindings_activate_event(GTK_OBJECT(o), event)) return TRUE;
+		if(w && gtk_bindings_activate_event(GTK_OBJECT(w), event)) return TRUE;
 		focus_keeping_selection();
 	}
 	return FALSE;

------------------ 8< -------------------------------

git-apply inside the "src" directory segfaulted.

Signature · 1 line
Martin Waitz
#3 lore raw

PATCH 1/1 apply --cached: fix crash in subdirectory

The static variable "prefix" was shadowed by an unused parameter of the same name. In case of execution in a subdirectory, the static variable was accessed, leading to a crash.

---

On Sat, 20 Jan 2007, Martin Waitz wrote:

> git-apply inside the "src" directory segfaulted.

Well, that was not the complete truth now, was it? Cannily, you avoided mentioning the use of the "--cached" argument...

But as you see, your evil plan failed ;-)

 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin-apply.c +1 -1
index 54fd2cb..ef927f8 100644
@@ -2589,7 +2589,7 @@ static int git_apply_config(const char *var, const char *value)
 }
 
 
-int cmd_apply(int argc, const char **argv, const char *prefix)
+int cmd_apply(int argc, const char **argv, const char *prefix2)
 {
 	int i;
 	int read_stdin = 1;
Signature · 1 line
1.5.0.rc1.gd85c
#4 lore raw

Re: [PATCH] apply --cached: fix crash in subdirectory

hoi :)

Quoted 6 lines · Johannes Schindelin

On Sat, 20 Jan 2007, Martin Waitz wrote:

> git-apply inside the "src" directory segfaulted.

Well, that was not the complete truth now, was it? Cannily, you avoided mentioning the use of the "--cached" argument...

You are right. I forgot to mention that in the bug report. Well, I was in a hurry...

Thanks for being faster in fixing the bug than I am in getting some spare time!

Quoted 1 line

But as you see, your evil plan failed ;-)

Damn!
I'll need a better plan next time...

;-)

Signature · 1 line
Martin Waitz