-2012-01-25 Vladimir Serbinenko <phcoder@gmail.com>
+2012-01-26 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/squash4.c (xz_decompress): Fix return value.
+ (direct_read): Use correct compressed size.
+ (grub_squash_read_data): Likewise.
+
+2012-01-26 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi (Platform limitations): New section.
(Platform-specific operations): Likewise.
xz_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
char *outbuf, grub_size_t len, struct grub_squash_data *data)
{
- grub_size_t ret;
+ grub_size_t ret = 0;
grub_off_t pos = 0;
struct xz_buf buf;
& grub_cpu_to_le32_compile_time (SQUASH_BLOCK_UNCOMPRESSED)))
{
char *block;
- block = grub_malloc (data->blksz);
+ grub_size_t csize;
+ csize = grub_le_to_cpu32 (ino->block_sizes[i]) & ~SQUASH_BLOCK_FLAGS;
+ block = grub_malloc (csize);
if (!block)
return -1;
err = grub_disk_read (data->disk,
>> GRUB_DISK_SECTOR_BITS,
(ino->cumulated_block_sizes[i] + a)
& (GRUB_DISK_SECTOR_SIZE - 1),
- data->blksz, block);
+ csize, block);
if (err)
{
grub_free (block);
return -1;
}
- if (data->decompress (block, data->blksz, boff, buf, read, data)
+ if (data->decompress (block, csize, boff, buf, read, data)
!= (grub_ssize_t) read)
{
grub_free (block);
if (compressed)
{
char *block;
- block = grub_malloc (data->blksz);
+ block = grub_malloc (frag.size);
if (!block)
return -1;
err = grub_disk_read (data->disk,
a >> GRUB_DISK_SECTOR_BITS,
a & (GRUB_DISK_SECTOR_SIZE - 1),
- data->blksz, block);
+ frag.size, block);
if (err)
{
grub_free (block);
return -1;
}
- if (data->decompress (block, data->blksz, b, buf, len, data)
+ if (data->decompress (block, frag.size, b, buf, len, data)
!= (grub_ssize_t) len)
{
grub_free (block);