+2012-05-04 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Fix errors on compressed NTFS with 512B clusters.
+
+ * include/grub/ntfs.h (grub_ntfscomp_func_t): Use appropriately sized
+ types.
+ * grub-core/fs/ntfs.c (grub_ntfs_read): Return correct -1 on error and
+ not 0.
+ * grub-core/fs/ntfscomp.c (read_block): Use appropriately-sized types.
+ Relax check for inline extents.
+ (ntfscomp): Return correct -1 on error and not 0.
+
2012-05-04 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Fix handling of prefix containing spaces.
mft->attr.save_pos = 1;
read_attr (&mft->attr, buf, file->offset, len, 1, file->read_hook);
- return (grub_errno) ? 0 : len;
+ return (grub_errno) ? -1 : (grub_ssize_t) len;
}
static grub_err_t
}
static grub_err_t
-read_block (struct grub_ntfs_rlst *ctx, char *buf, int num)
+read_block (struct grub_ntfs_rlst *ctx, char *buf, grub_size_t num)
{
int cpb = GRUB_NTFS_COM_SEC / ctx->comp.spc;
while (num)
{
- int nn;
+ grub_size_t nn;
if ((ctx->target_vcn & 0xF) == 0)
{
- if (ctx->comp.comp_head != ctx->comp.comp_tail)
+ if (ctx->comp.comp_head != ctx->comp.comp_tail
+ && !(ctx->flags & GRUB_NTFS_RF_BLNK))
return grub_error (GRUB_ERR_BAD_FS, "invalid compression block");
ctx->comp.comp_head = ctx->comp.comp_tail = 0;
ctx->comp.cbuf_vcn = ctx->target_vcn;
nn *= cpb;
while ((ctx->comp.comp_head < ctx->comp.comp_tail) && (nn))
{
- int tt;
+ grub_disk_addr_t tt;
tt =
ctx->comp.comp_table[ctx->comp.comp_head][0] -
}
static grub_err_t
-ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
- grub_uint32_t len, struct grub_ntfs_rlst *ctx, grub_uint32_t vcn)
+ntfscomp (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
+ grub_size_t len, struct grub_ntfs_rlst *ctx, grub_disk_addr_t vcn)
{
grub_err_t ret;
typedef grub_err_t (*grub_ntfscomp_func_t) (struct grub_ntfs_attr * at,
char *dest,
- grub_uint32_t ofs,
- grub_uint32_t len,
+ grub_disk_addr_t ofs,
+ grub_size_t len,
struct grub_ntfs_rlst * ctx,
- grub_uint32_t vcn);
+ grub_disk_addr_t vcn);
extern grub_ntfscomp_func_t grub_ntfscomp_func;