+2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/squash4.c (grub_squash_inode): Fix field sizes.
+ (grub_squash_dirent_header): Likewise.
+ (read_chunk): Don't double swap.
+ (grub_squash_iterate_dir): Fix swap sizes.
+
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/jfs.c (grub_jfs_getent): Handle UTF16 endianness.
grub_uint32_t dummy;
grub_uint32_t chunk;
grub_uint32_t fragment;
- grub_uint32_t offset;
+ grub_uint16_t offset;
+ grub_uint16_t dummy2;
grub_uint32_t size;
grub_uint32_t block_size[0];
} __attribute__ ((packed)) file;
grub_uint64_t size;
grub_uint32_t dummy2[3];
grub_uint32_t fragment;
- grub_uint32_t offset;
- grub_uint32_t dummy3;
+ grub_uint16_t offset;
+ grub_uint16_t dummy3;
+ grub_uint32_t dummy4;
grub_uint32_t block_size[0];
} __attribute__ ((packed)) long_file;
struct {
grub_uint32_t chunk;
grub_uint32_t dummy2;
grub_uint16_t size;
- grub_uint32_t offset;
+ grub_uint16_t offset;
grub_uint16_t dummy3;
+ grub_uint16_t dummy4;
} __attribute__ ((packed)) dir;
struct {
grub_uint64_t dummy;
{
/* Actually the value is the number of elements - 1. */
grub_uint32_t nelems;
- grub_uint64_t ino_chunk;
+ grub_uint32_t ino_chunk;
+ grub_uint32_t dummy;
} __attribute__ ((packed));
struct grub_squash_dirent
static grub_err_t
read_chunk (struct grub_squash_data *data, void *buf, grub_size_t len,
- grub_uint64_t chunk, grub_off_t offset)
+ grub_uint64_t chunk_start, grub_off_t offset)
{
- grub_uint64_t chunk_start;
- chunk_start = grub_le_to_cpu64 (chunk);
while (len > 0)
{
grub_uint64_t csize;
unsigned i;
/* FIXME: why - 3 ? */
- endoff = grub_le_to_cpu32 (dir->ino.dir.size) + off - 3;
+ endoff = grub_le_to_cpu16 (dir->ino.dir.size) + off - 3;
while (off < endoff)
{
if (err)
return 0;
off += sizeof (dh);
- for (i = 0; i < (unsigned) grub_le_to_cpu16 (dh.nelems) + 1; i++)
+ for (i = 0; i < (unsigned) grub_le_to_cpu32 (dh.nelems) + 1; i++)
{
char *buf;
int r;
read = grub_le_to_cpu32 (data->sb.block_size) - boff;
if (read > len)
read = len;
- if (!(ino->block_sizes[i] & SQUASH_BLOCK_UNCOMPRESSED))
+ if (!(ino->block_sizes[i]
+ & grub_cpu_to_le32_compile_time (SQUASH_BLOCK_UNCOMPRESSED)))
err = grub_zlib_disk_read (data->disk,
ino->cumulated_block_sizes[i] + a,
boff, buf, read);