X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fdentry.c;h=f986f9df12fbfe02624b70bbc66dee964565028c;hp=47a6175d789bbd3579a2d5ce381d80ddfa8d20b1;hb=19fd5bbc4f64cc8bf735f7c2c0bb864876998cf4;hpb=f5d26d6005ba759762bec8c7cd45a738e577a8a7;ds=sidebyside diff --git a/src/dentry.c b/src/dentry.c index 47a6175d..f986f9df 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -70,6 +70,8 @@ struct wim_ads_entry_on_disk { utf16lechar stream_name[]; } _packed_attribute; +#define WIM_ADS_ENTRY_DISK_SIZE 38 + /* WIM directory entry (on-disk format) */ struct wim_dentry_on_disk { le64 length; @@ -105,6 +107,8 @@ struct wim_dentry_on_disk { /*utf16lechar short_name[];*/ } _packed_attribute; +#define WIM_DENTRY_DISK_SIZE 102 + /* Calculates the unaligned length, in bytes, of an on-disk WIM dentry that has * a file name and short name that take the specified numbers of bytes. This * excludes any alternate data stream entries that may follow the dentry. */ @@ -1387,6 +1391,8 @@ read_ads_entries(const u8 * restrict p, struct wim_inode * restrict inode, struct wim_ads_entry *ads_entries; int ret; + BUILD_BUG_ON(sizeof(struct wim_ads_entry_on_disk) != WIM_ADS_ENTRY_DISK_SIZE); + /* Allocate an array for our in-memory representation of the alternate * data stream entries. */ num_ads = inode->i_num_ads; @@ -1531,6 +1537,8 @@ read_dentry(const u8 * restrict metadata_resource, u64 metadata_resource_len, const struct wim_dentry_on_disk *disk_dentry = (const struct wim_dentry_on_disk*)p; + BUILD_BUG_ON(sizeof(struct wim_dentry_on_disk) != WIM_DENTRY_DISK_SIZE); + if ((uintptr_t)p & 7) WARNING("WIM dentry is not 8-byte aligned");