]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-06-11 Giuseppe Caizzone <acaizzo@gmail.com>
authorphcoder <phcoder@localhost>
Thu, 11 Jun 2009 19:32:13 +0000 (19:32 +0000)
committerphcoder <phcoder@localhost>
Thu, 11 Jun 2009 19:32:13 +0000 (19:32 +0000)
UDF fix

* fs/udf.c (grub_udf_read_block): handle the fact that ad->length
is in bytes and not in blocks

ChangeLog
fs/udf.c

index b9a417cc4c3b8b3fed7eae017735c872abd736b5..ed7c06d5c48e5f54a0f5432ebd421b34aaf8e71d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-11  Giuseppe Caizzone  <acaizzo@gmail.com>
+
+       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  <proski@gnu.org>
 
        * kern/i386/halt.c (grub_halt): Make `i' unsigned to fix a
index 7741d45e7394432ab35f3aba108e4f61f2e95b85..9dfe431f6c0ca206d9b7011ef0bb8f00ee700fb1 100644 (file)
--- 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--;
        }