diff --git a/ChangeLog b/ChangeLog index b9a417cc4..ed7c06d5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-11 Giuseppe Caizzone + + UDF fix + + * fs/udf.c (grub_udf_read_block): handle the fact that ad->length + is in bytes and not in blocks + 2009-06-11 Pavel Roskin * kern/i386/halt.c (grub_halt): Make `i' unsigned to fix a diff --git a/fs/udf.c b/fs/udf.c index 7741d45e7..9dfe431f6 100644 --- a/fs/udf.c +++ b/fs/udf.c @@ -407,6 +407,7 @@ grub_udf_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) { char *ptr; int len; + grub_disk_addr_t filebytes; if (U16 (node->fe.tag.tag_ident) == GRUB_UDF_TAG_IDENT_FE) { @@ -425,16 +426,17 @@ grub_udf_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) struct grub_udf_short_ad *ad = (struct grub_udf_short_ad *) ptr; len /= sizeof (struct grub_udf_short_ad); + filebytes = fileblock * GRUB_UDF_BLKSZ; while (len > 0) { - if (fileblock < U32 (ad->length)) + if (filebytes < U32 (ad->length)) return ((U32 (ad->position) & GRUB_UDF_EXT_MASK) ? 0 : (grub_udf_get_block (node->data, node->part_ref, ad->position) - + fileblock)); + + (filebytes / GRUB_UDF_BLKSZ))); - fileblock -= U32 (ad->length); + filebytes -= U32 (ad->length); ad++; len--; } @@ -444,16 +446,17 @@ grub_udf_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) struct grub_udf_long_ad *ad = (struct grub_udf_long_ad *) ptr; len /= sizeof (struct grub_udf_long_ad); + filebytes = fileblock * GRUB_UDF_BLKSZ; while (len > 0) { - if (fileblock < U32 (ad->length)) + if (filebytes < U32 (ad->length)) return ((U32 (ad->block.block_num) & GRUB_UDF_EXT_MASK) ? 0 : (grub_udf_get_block (node->data, ad->block.part_ref, ad->block.block_num) - + fileblock)); + + (filebytes / GRUB_UDF_BLKSZ))); - fileblock -= U32 (ad->length); + filebytes -= U32 (ad->length); ad++; len--; }