Lines Matching refs:offset
104 __u32 offset; member
135 static void *check_access(struct zip_archive *archive, __u32 offset, __u32 size) in check_access() argument
137 if (offset + size > archive->size || offset > offset + size) in check_access()
140 return archive->data + offset; in check_access()
146 static int try_parse_end_of_cd(struct zip_archive *archive, __u32 offset) in try_parse_end_of_cd() argument
152 eocd = check_access(archive, offset, sizeof(*eocd)); in try_parse_end_of_cd()
157 if (offset + sizeof(*eocd) + comment_length != archive->size) in try_parse_end_of_cd()
177 int64_t limit, offset; in find_cd() local
187 offset = archive->size - sizeof(struct end_of_cd_record); in find_cd()
188 limit = (int64_t)offset - (1 << 16); in find_cd()
190 for (; offset >= 0 && offset > limit && rc != 0; offset--) { in find_cd()
191 rc = try_parse_end_of_cd(archive, offset); in find_cd()
248 __u32 offset) in local_file_header_at_offset() argument
252 lfh = check_access(archive, offset, sizeof(*lfh)); in local_file_header_at_offset()
259 static int get_entry_at_offset(struct zip_archive *archive, __u32 offset, struct zip_entry *out) in get_entry_at_offset() argument
266 lfh = local_file_header_at_offset(archive, offset); in get_entry_at_offset()
270 offset += sizeof(*lfh); in get_entry_at_offset()
274 name = check_access(archive, offset, lfh->file_name_length); in get_entry_at_offset()
278 offset += lfh->file_name_length; in get_entry_at_offset()
279 if (!check_access(archive, offset, lfh->extra_field_length)) in get_entry_at_offset()
282 offset += lfh->extra_field_length; in get_entry_at_offset()
284 data = check_access(archive, offset, compressed_size); in get_entry_at_offset()
293 out->data_offset = offset; in get_entry_at_offset()
302 __u32 i, offset = archive->cd_offset; in zip_archive_find_entry() local
309 cdfh = check_access(archive, offset, sizeof(*cdfh)); in zip_archive_find_entry()
313 offset += sizeof(*cdfh); in zip_archive_find_entry()
315 cdfh_name = check_access(archive, offset, cdfh_name_length); in zip_archive_find_entry()
323 memcmp(file_name, archive->data + offset, file_name_length) == 0) { in zip_archive_find_entry()
324 return get_entry_at_offset(archive, cdfh->offset, out); in zip_archive_find_entry()
327 offset += cdfh_name_length; in zip_archive_find_entry()
328 offset += cdfh->extra_field_length; in zip_archive_find_entry()
329 offset += cdfh->file_comment_length; in zip_archive_find_entry()