gfs2-utils: master - gfs2_edit: Fix segfault jumping within rindex

Bob Peterson rpeterso at fedoraproject.org
Wed Sep 7 19:06:56 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=3d4d902ad95128679c005373eda1e033e716d02f
Commit:        3d4d902ad95128679c005373eda1e033e716d02f
Parent:        35a6232630c764fb1c33e0a28fdc8edf556aa9d8
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Wed Sep 7 13:07:31 2011 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Wed Sep 7 13:11:46 2011 -0500

gfs2_edit: Fix segfault jumping within rindex

This patch fixes a segfault that occurs when you jump to an rindex
entry from the extended mode.  The problem was that the jump code
was assuming jumps occurred only from structures that had an indirect
data structure.  The rindex doesn't, so it tried to reference an
invalid entry in the indirect structure.
---
 gfs2/edit/hexedit.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index dd0cf60..5864e2d 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1920,7 +1920,7 @@ static void push_block(uint64_t blk)
 			blockstack[bhst].lines_per_row[i] = lines_per_row[i];
 		}
 		blockstack[bhst].gfs2_struct_type = gfs2_struct_type;
-		if (edit_row[dmode] >= 0)
+		if (edit_row[dmode] >= 0 && !block_is_rindex())
 			memcpy(&blockstack[bhst].mp,
 			       &indirect->ii[edit_row[dmode]].mp,
 			       sizeof(struct metapath));
@@ -2409,8 +2409,8 @@ static void jump(void)
 		int i;
 		
 		offset = 0;
+		push_block(temp_blk);
 		block = temp_blk;
-		push_block(block);
 		for (i = 0; i < DMODES; i++) {
 			start_row[i] = end_row[i] = edit_row[i] = 0;
 			edit_col[i] = 0;


More information about the cluster-commits mailing list