From 77ceedb634217a35d33fcaf01017516d3cb3f9ec Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 26 May 2012 11:54:20 +0200 Subject: [PATCH] Fix extent overflow comparator. * grub-core/fs/hfsplus.c (grub_hfsplus_extkey_internal): Add type. (grub_hfsplus_read_block): Set type. (grub_hfsplus_cmp_extkey): Compare type. --- ChangeLog | 8 ++++++++ grub-core/fs/hfsplus.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index c55fa79c5..adf4ebd95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-05-25 Vladimir Serbinenko + + Fix extent overflow comparator. + + * grub-core/fs/hfsplus.c (grub_hfsplus_extkey_internal): Add type. + (grub_hfsplus_read_block): Set type. + (grub_hfsplus_cmp_extkey): Compare type. + 2012-05-25 Vladimir Serbinenko * util/grub-fstest.c (cmd_cmp): Fix stat'ing of wrong file. diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c index a84b60e09..42b2c01f1 100644 --- a/grub-core/fs/hfsplus.c +++ b/grub-core/fs/hfsplus.c @@ -189,6 +189,7 @@ struct grub_hfsplus_catkey_internal struct grub_hfsplus_extkey_internal { grub_uint32_t fileid; + grub_uint8_t type; grub_uint32_t start; }; @@ -341,6 +342,7 @@ grub_hfsplus_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) /* Set up the key to look for in the extent overflow file. */ extoverflow.extkey.fileid = node->fileid; + extoverflow.extkey.type = 0; extoverflow.extkey.start = fileblock - blksleft; if (grub_hfsplus_btree_search (&node->data->extoverflow_tree, @@ -579,6 +581,11 @@ grub_hfsplus_cmp_extkey (struct grub_hfsplus_key *keya, return 1; if (akey < extkey_b->fileid) return -1; + + if (extkey_a->type > extkey_b->type) + return 1; + if (extkey_a->type < extkey_b->type) + return -1; akey = grub_be_to_cpu32 (extkey_a->start); if (akey > extkey_b->start)