Skip to content

Commit

Permalink
debian/patches/byteswap_fix.diff: Fix a segfault on little-endian archs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremie-koenig committed Nov 29, 2011
1 parent 3b1a68d commit b2c78f8
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
genext2fs (1.4.1-4) UNRELEASED; urgency=low

* debian/patches/byteswap_fix.diff: New patch by Samuel Thibault,
fix a segfault in the byte swapping code on little-endian architectures
(closes: 644776).

-- Jérémie Koenig <[email protected]> Tue, 29 Nov 2011 17:18:12 +0100

genext2fs (1.4.1-3) unstable; urgency=low

* New maintainer (closes: 579369).
Expand Down
44 changes: 44 additions & 0 deletions debian/patches/byteswap_fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Index: genext2fs/genext2fs.c
===================================================================
--- genext2fs.orig/genext2fs.c 2011-11-29 17:36:06.000000000 +0100
+++ genext2fs/genext2fs.c 2011-11-29 17:37:37.000000000 +0100
@@ -1779,7 +1779,8 @@
assert(nod->i_block[EXT2_DIND_BLOCK] != 0);
for(i = 0; i < BLOCKSIZE/4; i++)
if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i )
- swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
+ if (((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])
+ swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]));
if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4)
return;
@@ -1792,7 +1793,8 @@
(BLOCKSIZE/4)*(BLOCKSIZE/4) +
i*(BLOCKSIZE/4)*(BLOCKSIZE/4) +
j*(BLOCKSIZE/4)) )
- swap_block(get_blk(fs,b2[j]));
+ if (b2[j])
+ swap_block(get_blk(fs,b2[j]));
else {
done = 1;
break;
@@ -1825,7 +1827,8 @@
swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]));
for(i = 0; i < BLOCKSIZE/4; i++)
if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i )
- swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
+ if (((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])
+ swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4)
return;
/* Adding support for triple indirection */
@@ -1839,7 +1842,8 @@
(BLOCKSIZE/4)*(BLOCKSIZE/4) +
i*(BLOCKSIZE/4)*(BLOCKSIZE/4) +
j*(BLOCKSIZE/4)) )
- swap_block(get_blk(fs,b2[j]));
+ if (b2[j])
+ swap_block(get_blk(fs,b2[j]));
else {
done = 1;
break;
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
c99_scanf.diff
autoconf.diff
blocksize+creator.diff
byteswap_fix.diff

0 comments on commit b2c78f8

Please sign in to comment.